Form Control Checkboxes (Not ActiveX Controls )

rameezl17

Board Regular
Joined
Mar 6, 2018
Messages
105
Hi Everyone,

I'm still new to coding and looking to learn more. One thing I can't figure out and I'm 100% sure its so easy. I am doing this through a Form Control because I know that ActiveX controls on an excel sheet causes resizing when the screen resolution changes.

So I have a Checkbox that says "Yes?" Named (CheckBox1). The Macro I assigned to it is that when you click on the checkbox it opens up "UserForm1". So the Code is straightforward.

Sub CheckBox1_Click()
UserForm1.Show
End Sub

That works fine, however when I go to uncheck the checkbox in the excel sheet, it causes UserForm1 to open again and then the "Yes?" Checkbox is unchecked. How can I make it so that when I uncheck the checkbox it doesn't show UserForm1, just unchecks the checkbox?

(I thought maybe if I do a Yes and No Checkbox If Checkbox "Yes?" Is Clicked (CheckBox1) Then Checkbox "No?"(CheckBox2) will be unchecked automatically . I'm Not sure what's the best way to get this done, but I am struggling to figure it out.


If it helps. The scenario is just a Yes Or No Question Answer. So If you click Yes, it opens up a userform, but if you click No a msgbox opens up to tell you to move on to the next question.

Thank you so much for your help!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
NOTE: For a Yes\No you should use a RadioButton so they can only select one at a time. Checkboxes are for multiple choice.
 
Upvote 0
Fully qualify your object. I don't know where your checkbox lives. Apparently, neither does Excel. You have to tell someone.

Code:
UserForm???????.CheckBox1.Value
 
Upvote 0
I Just tried the same If Then Logic with the Option Button

Sub OptionButton1_Click()
If OptionButton1.Value = True Then UserForm1.Show
Else
"I'm Not sure what goes in here"
End If
End Sub


Its not working like the site you sent me...I'm assuming because I'm using a form control, not a ActiveX form.
 
Upvote 0
Fully qualify your object. Where is the form control?

Code:
FORMNAME.CheckBox1.Value
 
Upvote 0

Forum statistics

Threads
1,215,580
Messages
6,125,652
Members
449,245
Latest member
PatrickL

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