• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need to be able to select only 1 of 3 checkboxes

txfrazier

New Member
I have a UserForm with 5 columns and 3 checkboxes in each column. The user can only check 1 of the three check boxes in each column. What VBA code would I use to manage this part of the form. I have use the following when the user can only select one checkbox or the other:

[pre]
Code:
Private Sub chk1_chkbox_Click()
chk2_chkbox = Not (chk1_chkbox)
End Sub
[/pre]

Radio buttons won't work for this application since there are more than 30 checkboxes on this form.


Thanks in advance for your help.
 
Hi, txfrazier!


I'd change that code by something alike:

----.

[pre]
Code:
Private Sub chk1_chkbox_Click()
Dim b As Boolean
b = Not (chk1_chkbox)
If b Then
chk2_chkbox = b
chk3_chkbox = b
chk4_chkbox = b
chk5_chkbox = b
chk6_chkbox = b
' until last one in column
End If
End Sub
[/pre]
-----


You could too create a procedure for all the check boxes for each column and condition it to not change the value of ActiveControl.


Regards!
 
Hi txfrazier,


Just FYI..


Radio Button will work.. if you give Same "GroupName" for each of the 3 RadioButton Group..


Regards,

Deb
 
Back
Top