Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi,
I was hoping someone could tell me why my msgbox gets triggered twice?
Its in the comboboxchange so my initial guess was because i was making Comboxarea2B.value="" that it was triggering it again but if this is the case then how do I make Comboxarea2B value blank without triggering the code again?
Many thanks in advance for your help,
Mike
I was hoping someone could tell me why my msgbox gets triggered twice?
Its in the comboboxchange so my initial guess was because i was making Comboxarea2B.value="" that it was triggering it again but if this is the case then how do I make Comboxarea2B value blank without triggering the code again?
Many thanks in advance for your help,
Mike
VBA Code:
Private Sub Comboxarea2B_Change()
Dim Q As Worksheet
Dim myvalue2 As String
Dim p As Range
Dim myvalue3 As String
If Comboxarea2.Value = "" Then
Comboxarea2B.Value = ""
MsgBox "Select Area one First", , "Area One"
Exit Sub
End If
If Optmajor2.Value = True Then
TextBox2.Text = Comboxmajor2.Value
Else
If Optminor2.Value = True Then
TextBox2.Text = Comboxnumber2.Value & " OF " & Comboxminor2.Value
End If
End If
Set Q = Worksheets("Interpretations")
myvalue2 = TextBox2.Value & " " & Comboxarea2B.Value
Set p = Q.Range("A:MM").Find(myvalue2, LookIn:=xlValues, lookat:=xlWhole)
If Not p Is Nothing Then
TBanswer2.Value = TBanswer2.Text & vbNewLine & p.Offset(0, 1).Value
Else
Set Q = Worksheets("Interpretations")
myvalue3 = Comboxmajor2.Value & " " & Comboxarea2.Value
Set p = Q.Range("A:MM").Find(myvalue3, LookIn:=xlValues, lookat:=xlWhole)
If Not p Is Nothing Then
TBanswer2.Value = TBanswer2.Text & vbNewLine & p.Offset(0, 1).Value
Else
TBanswer2.Value = ""
End If
End If
End Sub