I'm having a problem with Excel VBA UserForm Events in Office Excel 2013 as follows
- Simple userform with three check boxes (CB1,2,3) and two buttons Cancel and OK
- When checking CB1 set CB3 = false
- When checking CB2 set CB3 = false
- When checking CB3 set CB1 = false and CB2 = false
I have read and understood http://www.cpearson.com/excel/SuppressChangeInForms.htm regarding the suppression of UserForm Events and to part it works...
In the list above 2. and 3. above work correctly in code (shown below) and no-events are fired for CB3. However when I do 4. Check CB3 - it fires events for CB1 and CB2, even though I have set it to not fire events.
Any help gratefully received,
Best regards
Seán
Code:
Public EnableEvents As Boolean
Private Sub UserForm_Initialize()
Me.EnableEvents = True
End Sub
Private Sub vboInputsSelected_Click()
Me.EnableEvents = False
vboPracticesSelected.value = False 'this line does NOT fire an event
Me.EnableEvents = True
End Sub
Private Sub vboOutputsSelected_Click()
Me.EnableEvents = False
vboPracticesSelected.value = False 'this line does NOT fire an event
Me.EnableEvents = True
End Sub
Private Sub vboPracticesSelected_Click()
Me.EnableEvents = False
vboInputsSelected.value = False 'this line DOES fire an event
vboOutputsSelected.value = False 'this line DOES fire an event
Me.EnableEvents = True
End Sub