将输入值从输入框传递到另一个私有子代码?

时间:2018-06-15 06:39:02

标签: vba inputbox

所以基本上我正在努力做到以下几点:

  1. 当激活/选择特定工作表时,我想要一个输入框 显示。
  2. 从该输入框中我想获得可以找到的特定范围 在那张特定的表格中。
  3. 现在,一旦定义了自定义范围,我将使用另一个私有子来分析在该特定范围内是否满足所需条件(由输入框定义)。

    以下是我目前正在使用的代码。

    Private Sub Worksheet_Activate()
    Dim x As Range
    Set x = Application.InputBox(prompt:="Please select the range you want to be verified for results", Title:="Notifier", Default:="Ex: $A$5:$B$30", Type:=8)
    End Sub
    
    Private Sub Worksheet_Change(ByVal Target As Range)
       Dim A As Range
       Dim r As Range
       Set objShell = CreateObject("Wscript.Shell")
       Set A = x.Range
       If Intersect(Target, A) Is Nothing Then Exit Sub
       For Each r In Target
           If r.Value = "FAIL" Then
              intMessage = MsgBox("Please be aware that you have marked one of the required verification points as [Fail]" & vbCr _
              & vbCr _
              & "To improve the visibility over this issue please submit a new Jira ticket for it." & vbCr _
              & vbCr _
              & "Would you like to create the ticket now?", _
              vbYesNo, "Notifier")
              If intMessage = vbYes Then
              objShell.Run ("https://custom_link")
              Else
              End If
           End If
       Next r
    End Sub
    

0 个答案:

没有答案