multiple criteria

J

Jessie

Hello,

I have a sheet with 3 checkboxes from the control tool box. I want to ensure
that the user only selects one checkbox at a time, I want to add validation
then pop a message box instructing the user to only select one at a time.
After the user clicks ok I want to clear all the check boxes.

The issue i have with the code below is when the boxes are cleared the
message pops up again. If all three are checked it pops 3 times. So was
thinking to add an additional validation like if OSCE10=true AND if
OSCE73=true then...elseif OSCE10 and OSCE80=true then if OSCE=false do
nothing?? hmm i am not sure, but the clearing the checkboxes launches the
code again i think and that's why i get the 3 message boxes...

Private Sub OSCE10_Click()
Dim oSheet As Worksheet
Dim oControl As OLEObject
If OSCE73 = True Then
msgbox ("Please only Select One OSCE version at a time.")
With Sheet4
For Each oControl In .OLEObjects
If TypeName(oControl.Object) = "CheckBox" Then
oControl.Object.Value = False
End If
Next oControl
End With
ElseIf OSCE8 = True Then
msgbox ("Please only Select One OSCE version at a time.")
With Sheet4
For Each oControl In .OLEObjects
If TypeName(oControl.Object) = "CheckBox" Then
oControl.Object.Value = False
End If
Next oControl
End With
End If

Thank you for any help you can provide. (suggestions on other ways to
accomplish this would be great.) Access forms has an option group, but i
couldn't find one in excel which is why i am going through the validation code
 
H

HarveyM.

Wouldn't it be easier just to have radio buttons rather than checkboxes? That
way only one can be chosen within the linked box
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top