Use a checkbox output in my vba

merry_fay

Board Regular
Joined
Oct 28, 2010
Messages
54
This should be simple right?

I've inserted an ActiveXControl Checkbox into my spreadsheet -it's definitely an ActiveX one & not a form one as I've checked several times & even added a form one just to make sure they were different.

I now want to use it in my code, but just can't get it working!!

This:
Code:
If ActiveSheet.CheckBox("cb_Cash_Y").Value = True Then

gives the response: Object doesn't support this property or method

& this:
Code:
If cb_Cash_Y.Value = True Then

gives the response: Object required

How do I refer to it? I used the Properties box to change the (name) category to cb_Cash_Y & I've, again, checked multiple times I'm using the correct name.

Thanks
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
You need to declare the fact it is an ActiveX control, like this:

Code:
Dim CashCheckBox As MSForms.Checkbox

Set CashCheckBox = Activesheet.cb_Cash_Y
'Your code here
 
Last edited:
Upvote 0
Hi,

You can try
Code:
If ActiveSheet.Shapes("cb_Cash_Y").Value = True Then
 
Upvote 0
Thanks both for your replies.

I'm afraid your solution still says Object not supported though James006.
Yours works a treat digidave (y)
 
Upvote 0

Forum statistics

Threads
1,213,485
Messages
6,113,931
Members
448,533
Latest member
thietbibeboiwasaco

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