Check the value of a checkbox

amarokWPcom

New Member
Joined
May 30, 2019
Messages
25
I have a toll as a Workbook.

All my subroutines are in a reference (read-only) on the server, so my team membershave access with their tools to use the subroutines.

In my tool I want to use If..then decisions declared by checkboxes.

Unfortunately all of this is not working and I don't understand why:

F.e. the Checkbox is on
Worksheet("UI")

the Checkbox is named
CheckBox2

the text in the checkbox is
Test Mode

in the function field is written
=EMBED("Forms.CheckBox.1";"")

Why this is all not working AND what the hell is working to check the value of the box ?

If Worksheets("UI").OLEObjects("CheckBox2").Value = True Then...

If Worksheets("UI").Shapes("Test Mode").ControlFormat.Value = True Then...

If Worksheets("UI").Shapes("Test Mode").OLEFormat.Object.Value = True Then...

If Worksheets("UI").CheckBoxes("Test Mode").Value = True Then...
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
To check the value of a worksheet check box:
VBA Code:
If Worksheets("UI").Shapes("Check Box 1").OLEFormat.Object.Value = 1 Then

Ensure the name is correct. The first checkbox will always be Check Box 1 as default
 
Upvote 0
What's the name of the checkbox?

Where is the code that's trying to check it located?
 
Upvote 0
What's the name of the checkbox?

Where is the code that's trying to check it located?
F.e. the Checkbox is on
Worksheet("UI")

the Checkbox is named
CheckBox2

the text in the checkbox is
Test Mode

in the function field is written
=EMBED("Forms.CheckBox.1";"")

Why this is all not working AND what the hell is working to check the value of the box ?

If Worksheets("UI").OLEObjects("CheckBox2").Value = True Then...

If Worksheets("UI").Shapes("Test Mode").ControlFormat.Value = True Then...

If Worksheets("UI").Shapes("Test Mode").OLEFormat.Object.Value = True Then...

If Worksheets("UI").CheckBoxes("Test Mode").Value = True Then...
 
Upvote 0
You need to use
VBA Code:
If Worksheets("UI").CheckBox2.Value = True Then
 
Upvote 0
That means you don't have an activeX checkbox called "CheckBox2" on that sheet.
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,022
Members
448,939
Latest member
Leon Leenders

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