Calling a checkbox_click from VBA

bbhgroup

Board Regular
Joined
Dec 30, 2008
Messages
97
I have a checkbox subroutine Checkbox4_Click() that works when clicked on the spreadsheet. I want to call this same function inline from VBA but I can't seem to get the syntax right.

Any help?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
so what have you tried?

I've used in VBA something like this:
If CheckBox3 = False And CheckBox4 = False Then
MsgBox "The select option for FRF was not checked"
 
Upvote 0
I've been using the object browser to try and figure it out. So far I have:

Code:
VBAProject.Sheet1.CheckBox4_Click (VBAProject.Sheet1.CheckBox4.Value)
but I get a "compile error' and the "CheckBox4_Click" is highlighted.

Ah, I figured it out.
First I had to change the CheckBox4_Click to be a public sub.
Then I changed to code to:
Code:
VBAProject.Sheet1.CheckBox4_Click

Since no arguments are necessary!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,202,912
Messages
6,052,520
Members
444,588
Latest member
ViJN

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