toggling checkboxes

T

Tony

I want to add several checkboxes to the worksheet and to have them working
similar to option box, so that only one can be selected in any particulart
time. I have created several procedures acting on CheckBox_click event but I
can not figure on how to set the values for other checkboxes. Using

CheckBox2.Value = False

or

CheckBox2.Value = 0

does not work, I am getting error messages related to missing objects. How
my code should look like ? Thanks for help.

Regards,
 
F

FSt1

hi
here is one way to do it. you may have to work your other code in/around it.
the trick is that if one checkbox is true(checked) the others are set to
false with all checkboxes looking at all the other checkboxes.
Private Sub CheckBox1_Click()
If CheckBox1 = True Then
CheckBox2 = False
CheckBox3 = False
End If
End Sub

Private Sub CheckBox2_Click()
If CheckBox2 = True Then
CheckBox1 = False
CheckBox3 = False
End If
End Sub

Private Sub CheckBox3_Click()
If CheckBox3 = True Then
CheckBox1 = False
CheckBox2 = False
End If
End Sub

regards
FSt1
 

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