Should I use a radio button or checkbox?

sous2817

Well-known Member
Joined
Feb 22, 2008
Messages
2,276
Hello, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
I'm making a worksheet where the user has the options to select "yes" or "no". I used active x radio buttons because I feel they are more flexible. The problem I'm running in to is, what happens if there is an "unknown"? I can't find a way to "deselect" a radio button?<o:p></o:p>
<o:p></o:p>
I tried using 2 checkboxes using the following code:
<o:p></o:p>
Checkbox 1:
Rich (BB code):
If CheckBox2.Value = True Then
CheckBox1.Value = False
End If 
<o:p></o:p>
Checkbox2:
Rich (BB code):
If CheckBox1.Value = True Then
CheckBox2.Value = False
End If
<o:p></o:p>
The problem with this is, you have to deselect one checkbox before you can select the other. It works, but it’s a little more cumbersome then I was hoping. Is there a better solution?

Thanks for your time,<o:p></o:p>
 
Welcome to the Board!

If there is an unknown, why don't you add a third radio button or checkbox that is somehting like N/A or Don't Know?
 
Upvote 0
Thank you for the welcome! <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
The main reason I'm not using a third column is to conserve space. I'm trying to keep it all on 1 printable page. Also, because of lack of foresight on my part, I need to fix this design oversight (or as I'm going to call it in my meeting, a "new feature has been added") in more than one column. I'd rather cut / paste / edit code than rework a bunch of columns while preserving the flow. <o:p></o:p>
 
Upvote 0
Code:
Private Sub CheckBox1_Click()
CheckBox2.Value = CheckBox1.Value = False
End Sub
 
 
Private Sub CheckBox2_Click()
CheckBox1.Value = CheckBox2.Value = False
End Sub

Never mind, that makes it act exactly like a radio button...
 
Last edited:
Upvote 0
You could use:

Code:
Private Sub CheckBox2_Click()
CheckBox1.Value = Not CheckBox2.Value
End Sub

Private Sub CheckBox1_Click()
CheckBox2.Value = Not CheckBox1.Value
End Sub
But then again they are not allowed to have both unchecked.
 
Upvote 0
Is there any way to make it so I can deselect both check boxes or just have 1 selected. I guess what I need is the ability to uncheck both boxes, but just check one of them.


It would be easiest if I could just deselect a radio button, but I don't think that's possilbe...
 
Last edited:
Upvote 0
Perhaps
Code:
Private Sub CheckBox1_Click()
If CheckBox1.Value = TRUE Then CheckBox2.Value = FALSE
End Sub
 
 
Private Sub CheckBox2_Click()
If CheckBox2.Value = TRUE Then CheckBox1.Value = FALSE
End Sub
 
Upvote 0
What about Option Buttons (only one choice can be made)?

The objective was that OP needed to have the option of NIETHER selected.
With option buttons, 1 will always be selected, you can't have NONE selected.
 
Upvote 0

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