Stumper of a CheckBox??????

rkcim

Board Regular
Joined
Nov 19, 2003
Messages
87
Basically I am trying to do this

Sub(CheckBoxNumber as Integer)

Sheet1.CheckBox"CheckBoxNumber".Disabled = True
End Sub

Will this code work? If not how do I reference a CheckBox in that way?

My dilema is I have approx 5 checkboxes on a sheet, and supposing that all checkboxes are unchecked:
If I check CheckBox1 then that one does not get disabled. If the next check box I click is CheckBox 2 this will cause CheckBox1 to be disabled. The only way CheckBox1 will be enabled is if CheckBox2 is unchecked, which would enable CheckBox1 and allow it to be unchecked.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

TryingToLearn

Well-known Member
Joined
Sep 10, 2003
Messages
723
Sounds like you are trying to invent OptionButtons. If one is checked, the others are not. :wink:
 

rkcim

Board Regular
Joined
Nov 19, 2003
Messages
87
No, its not option buttons that I am trying to do.

These CheckBoxes are all unchecked, and enabled
I check the following checkboxes in this random order:
CheckBox1
CheckBox4 'causes CheckBox1 to be disabled
CheckBox3 'causes CheckBox4 to be disabled
CheckBox2 'causes CheckBox3 to be disabled
CheckBox5 'causes CheckBox2 to be disabled

They are now all checked all are disabled except CheckBox5 which is the last one to be checked. If I wanted to uncheck CheckBox1 I would have to uncheck these checkboxes in this order:
CheckBox5 'causes CheckBox2 to be enabled
CheckBox2 'causes CheckBox3 to be enabled
CheckBox3 'causes CheckBox4 to be enabled
CheckBox4 'causes CheckBox1 to be enabled
CheckBox1

Now all checkboxes are unchecked and enabled. I am trying to find an easy way of doing this. Any ideas? :p

Also if I check, for example, only 3 out of the 5 CheckBoxes to check, and I close the program and load it back up I need to beable to find out which ones were checked in order.
 

residnt

Board Regular
Joined
Nov 19, 2002
Messages
168
Well you almost have the answer that you need. I've done this in the past and I've used this code.

Private Sub CheckBox14_Click()
If (CheckBox14.Value = True) Then
CheckBox15.Enabled = True
Else
CheckBox15.Enabled = False
End If

If (CheckBox14.Value = True) Then
CheckBox13.Enabled = False
Else
CheckBox13.Enabled = True
End If

End Sub

Now this had to be entering into each checkbox and alter for each.

Let me know if this worked.

Residnt
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,816
Messages
5,772,453
Members
425,760
Latest member
paphon

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
Top