Option Explicit
Private ComboBox1_IsChanged As Boolean
Private ComboBox2_IsChanged As Boolean
Private ComboBox3_IsChanged As Boolean
Private Sub UserForm_Initialize()
ComboBox1.List = Array(1, 2, 3)
ComboBox2.List = Array(4, 5, 6)
ComboBox3.List = Array(7, 8, 9)
End Sub
Private Sub ComboBox1_Change()
Call CheckChanges(ComboBox1_IsChanged)
End Sub
Private Sub ComboBox2_Change()
Call CheckChanges(ComboBox2_IsChanged)
End Sub
Private Sub ComboBox3_Change()
Call CheckChanges(ComboBox3_IsChanged)
End Sub
Private Sub CheckChanges(ByRef IsChanged As Boolean)
IsChanged = True
If AllChanged Then
FireMacro
RevertChanged
End If
End Sub
Private Function AllChanged() As Boolean
AllChanged = ComboBox1_IsChanged And ComboBox2_IsChanged And ComboBox3_IsChanged
End Function
Private Sub FireMacro()
MsgBox "MacroFired!" & vbNewLine & vbNewLine & _
ComboBox1.Value & "~" & ComboBox2.Value & "~" & ComboBox3.Value
End Sub
Private Sub RevertChanged()
ComboBox1_IsChanged = False
ComboBox2_IsChanged = False
ComboBox3_IsChanged = False
End Sub