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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
12,639
Office Version
  1. 365
Platform
  1. Windows
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.
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,239
Why not just use option buttons, the behavior you say you want is what option buttons are designed for.
 

atvsource

Board Regular
Joined
Feb 26, 2009
Messages
86
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!
 

manu_the_menace

New Member
Joined
May 15, 2009
Messages
2

ADVERTISEMENT

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.
 

atvsource

Board Regular
Joined
Feb 26, 2009
Messages
86
Yes, we figured out a way to do this.. thanks for all the help and following up on this topic!
 

manu_the_menace

New Member
Joined
May 15, 2009
Messages
2

ADVERTISEMENT

Can you please share the solution in this thread. Even I need to implement this in my excel sheet. Thanks in advance. :)
 

atvsource

Board Regular
Joined
Feb 26, 2009
Messages
86
I'll have to get with the person that figure it out for us and let you know if and how we did this.
 

Nogslaw

Well-known Member
Joined
Jul 9, 2004
Messages
904
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
[
 

Watch MrExcel Video

Forum statistics

Threads
1,129,754
Messages
5,638,170
Members
417,011
Latest member
Amaden95

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