Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkboxes
I have a worksheet that has 5 checkboxes. I used the Contol Toolbox to place
these in the worksheet. How can I make sure the user checks at least one of the 5 checkboxes? I would like to add the code to a command button that the user will click when they send the form. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkboxes
Put this code behind the commandbutton
Private Sub CommandButton1_Click() If Not Me.CheckBox1.Value And _ Not Me.CheckBox2.Value And _ Not Me.CheckBox3.Value And _ Not Me.CheckBox4.Value And _ Not Me.CheckBox5.Value Then MsgBox "Nothing selected, try again" Else 'do your stuff End If End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tammy H" wrote in message ... I have a worksheet that has 5 checkboxes. I used the Contol Toolbox to place these in the worksheet. How can I make sure the user checks at least one of the 5 checkboxes? I would like to add the code to a command button that the user will click when they send the form. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkboxes
(think Horseshack from Welcome Back Kotter)
ooooh! ooooh! i know that one!!!! :) [with the disclaimer that SOMEBODY probably knows a better way to do it!] sub checks() 'untested If chk1.Value = False And _ chk2.Value = False And _ chk3.Value = False And _ chk4.Value = False And _ chk5.Value = False Then Msgbox "You must check at least one checkbox!", vbExclamation + vbOkOnly Else 'enter code to do if not ALL are unchecked. End If End sub susan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checkboxes | Excel Discussion (Misc queries) | |||
Using Checkboxes | Excel Programming | |||
Checkboxes and Other | Excel Programming | |||
checkboxes | Excel Programming | |||
Checkboxes | Excel Programming |