Mutually Exclusive Checkboxes

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I am trying to keep my file size down on my spreadsheet
which is fronted by a userform

On the userform there are several instances (30) where
only one checkbox of two can be ticked at once.
I am using the following code, but would like to know if
there are any more efficient methods of doing it, as this
makes for a lot of repetitive code!

Private Sub CheckBox171_Click()
If CheckBox171 = True Then
CheckBox181 = False
End If
End Sub
Private Sub CheckBox181_Click()
If CheckBox181 = True Then
CheckBox171 = False
End If
End Sub


Thanks

Richard
 
Richard,

A little simpler

Private Sub CheckBox171_Click()
CheckBox181.Value = Not CheckBox171.Value
End Sub

Private Sub CheckBox181_Click()
CheckBox171.Value = Not CheckBox181.Value
End Sub

Buit if you used Optionboxes you wouldn't need code as they only allow one
to be set.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Just to add, you don't have to use frames (although this gives a visible
clue about the relationship). You can assign them to the same unique group
(use any string you want for the group name).
 
I discovered GroupNames about two nights ago and had to slap my head! So
much easier than trying to build all those frames on the fly.

- Jon
 

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

Back
Top