#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkboxes Elaine Excel Discussion (Misc queries) 6 August 20th 09 01:41 AM
Using Checkboxes Brad Excel Programming 5 January 10th 05 08:47 PM
Checkboxes and Other cmk18[_3_] Excel Programming 1 April 5th 04 05:09 AM
checkboxes marksuza[_3_] Excel Programming 3 December 11th 03 03:19 PM
Checkboxes Tom Ogilvy Excel Programming 0 August 11th 03 05:45 PM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"