How Do I Get the Value of a CheckBox that Made Macro Call

MikeMcCollister

Board Regular
Joined
May 6, 2020
Messages
71
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet that has a checkbox on it. Because this spreadsheet will be edited many times, the checkbox will ultimately have multiple copies. Each checkbox will be calling the same macro. I want it this way because I don't want to create a new macro whenever I edit the spreadsheet. The ultimate plan is to have all checkboxes change to state of the checkbox that was just checked. So, is there a way to detect the state of the checkbox that triggered the macro?

Thanks,

Mike
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Not sure what the point of multiple checkboxes is, if they all have the same value, but are they Form control checkboxes?
 
Upvote 0
One question, if I use an ActiveX control checkbox, how do I attach a macro to that?

Thanks,

Mike
 
Upvote 0
You don't attach a macro to ActiveX controls... you put your code in its event procedures (similar to the way controls work on UserForms).
 
Upvote 0
You can find the value of the checkbox that was clicked like
VBA Code:
   Dim x As Long
   x = ActiveSheet.Shapes(Application.Caller).ControlFormat.Value
1 is checked & -4146 is unchecked
 
Upvote 0
Fluff and Rick,

Thank you both for your help.

I like that the ActiveX version puts the code in the sheet that I am using. Also, I can change the text color too, which I like. However, it does not look as crisp on the screen as the form control checkbox.

Just looking at the various options that I have.

Mike
 
Upvote 0
I tend to avoid ActiveX controls wherever possible as they are notoriously flaky.
 
Upvote 0
Fluff,

I'm starting to see how flaky the ActiveX control is.

Now if I can just change the color of the text in the form control checkbox to white. My life would be good.

Regards,

Mike
 
Upvote 0
AFAIK, you cannot change the text colour, are you trying to hide the text, or make it visible against a dark background?
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,560
Latest member
Torchwood72

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