Creating a user-defined event

Glory

Well-known Member
Joined
Mar 16, 2011
Messages
640
Do I use a class module?

User clicks a command button; command button toggles event on, so that clicking checkboxes clears their captions. Clicking the command button again toggles the event off.

Is this possible?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
It sounds like you don't need an event, but a flag. If he Command Button toggles a variable Flag between true and false, then code like this in the checkboxes will clear the caption at the appropriate time.
For forms controls, that would look like
Code:
Dim Flag As Boolean

Sub Button4_Click()
    Flag = Not Flag
End Sub

Sub CheckBox3_Click()
    If Flag Then
        ActiveSheet.Shapes(Application.Caller).TextFrame.Characters.Text = ""
    Else
        Rem other checkbox click action
    End If
End Sub
 
Upvote 0
Thanks very much for your input, mike. That's twice in two days you've pulled my *** out of the fire. I couldn't figure out either of these issues for the life of me, and the first (this one) was clear as day.

Edit: Would you mind explaining this line a little? "Rem other checkbox click action" Edit: Nevermind, I looked up the Rem statement and I understand.
 
Last edited:
Upvote 0
Tusharm: If I ever think I need to deal with events again, this is where I'll come first. I appreciate the link.
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top