Two Check Box Form, If Ones Selected Other Unselects Possible?

atvsource

Board Regular
Joined
Feb 26, 2009
Messages
86
I'm checking to see if this is possible. We have to check-box form and would like to set it up so that if one is selected the other is de-selected and vs verses.

So, if check-box form 1 is check marked, check-box form 2 cannot be check-marked. If check-box 2 was checked marked, when check-box 1 is check-marked, check-box 2 will uncheck mark itself.

Is that possible and how would one do it?

I've check different properties, but cannot find anything that will allow this.

We are using Office 2003.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try something like

Code:
Private Sub CheckBox1_Click()
     If Shapes("check box 1").ControlFormat.Value = xlOn Then
          Shapes("check box 2").ControlFormat.Value = xlOff
        End If
End Sub

Then reverse the box numbers for checkbox2_click
I've used this code on a worksheet checkbox, but not on a userform so it may need modifiying.

Hope this helps.
 
Upvote 0
Why not just use option buttons, the behavior you say you want is what option buttons are designed for.
 
Upvote 0
The reason we are not using option buttons, is you can select up to five different options; however, two of these options cannot be duplicate, so if you check one, the other is unchecked. The macro option provided Jason gave us a starting point and we where able to work out the functions to get it to work the way we wanted it. I just haven't returned to thank Jason yet, as we were still testing it.

So, without further a due, Thanks Jason for providing us a starting point!
 
Upvote 0
Hi atvsource,

Were you able to a get a solution for this? Even I have a similar requirement. Please let me know if you have got a solution.
 
Upvote 0
I'll have to get with the person that figure it out for us and let you know if and how we did this.
 
Upvote 0
you can do something like this

Code:
Dim disabled As Boolean

Private Sub CheckBox1_Click()
If disabled Then Exit Sub
disabled = True
CheckBox1.Value = True
CheckBox2.Value = False
CheckBox3.Value = False
disabled = False
End Sub

Private Sub CheckBox2_Click()
If disabled Then Exit Sub
disabled = True
CheckBox1.Value = False
CheckBox2.Value = True
CheckBox3.Value = False
disabled = False
End Sub

Private Sub CheckBox3_Click()
If disabled Then Exit Sub
disabled = True
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox3.Value = True
disabled = False
End Sub
[
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

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