I want to apply the following click event for all ActiveX checkboxes on my sheet. It's really simple - it turns the background color yellow if checked and white if unchecked:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
CheckBox1.BackColor = vbYellow
Else
CheckBox1.BackColor = vbWhite
End If
End Sub
How can I apply this click event to all checkboxes now and for future checkboxes that I create? I googled it and some people suggested classmodules and Private WithEvents, but I can't seem to figure it out!
Edit: I want to apply this 1 click event for the specific box being clicked, not turn all boxes yellow! I dont want to write 50 CheckBoxn_Click subs!