当客户端在我的组合框中选择一个项目(RejectTitleNm)时,我试图弹出一个输入框,这样它就会提示他们输入3个值中的1个(邮件,在线,电话)。一旦选择了需要的值,我想要“Dim F as Range,v”继续但它会停止。不确定我做错了什么。如果取消或输入了错误的值,我还希望禁用“Dim F as Range,v”。
请帮忙!这是我到目前为止:/
Private Sub RejectTitleNm_Change()
Dim stringName As String
'InputBox(prompt[, title] [, default] )
stringName = InputBox("Please enter Channel (i.e. Mail, Online or Phone:", "CHANNEL ENTRY BOX", "Enter Reject Title")
If stringName = "online" Then
Exit Sub
Me.RejectTitleNm.Enabled = True
End If
'Exit sub if user press Cancel button or does not enter any text in the Input field.
If stringName = vbNullString Then
' *** Clear fields and close inputbox ***
RejectTitleNm = ""
Exit Sub
End If
MsgBox "Hello " & stringName
' *** Clear fields after Ok ***
RejectTitleNm = ""
Exit Sub
Dim f As Range, v
v = Me.RejectTitleNm.Value
'find the selected value in the source range
Set f = Range("RejectTitle").Find(v, lookat:=xlWhole)
Me.TextBox1.Text = ""
If Not f Is Nothing Then
'got a match: get value from ColB(Issue) on same row
Me.TextBox1.Text = f.EntireRow.Cells(, "B").Value
'got a match: get value from ColC(TA) on same row
Me.TextBox2.Text = f.EntireRow.Cells(, "C").Value
'got a match: get value from ColD(VBA) on same row
Me.TextBox3.Text = f.EntireRow.Cells(, "D").Value
End If
End Sub