Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Validating checkboxes

Hi All,
I have an Excel sheet that has several checkboxes. I also have a command
button that when clicked the form is emailed. When the user clicks the
cammand button I need to verify that at least one checkbox in each category
is checked before the form is emailed. I tried something like:

If CheckBox1.Value = False And CheckBox2.Value = False And CheckBox3.Value =
False And CheckBox36.Value = False And CheckBox38.Value = False Then

MsgBox "Please check reason for request!"
Range("A11").Select

End If

I receive the msgbox, but when I click ok, the form is emailed even though
there isn't any checkboxes checked. I think I need code after the msgbox
line but I am not sure how to do this. Can someone help me?



  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Validating checkboxes

See change below.

If CheckBox1.Value = False _
And CheckBox2.Value = False _
And CheckBox3.Value = False _
And CheckBox36.Value = False _
And CheckBox38.Value = False Then

MsgBox "Please check reason for request!"
Range("A11").Select
Exit sub '<<<<<Add this
End If

--
JNW


"Tammy H" wrote:

Hi All,
I have an Excel sheet that has several checkboxes. I also have a command
button that when clicked the form is emailed. When the user clicks the
cammand button I need to verify that at least one checkbox in each category
is checked before the form is emailed. I tried something like:

If CheckBox1.Value = False And CheckBox2.Value = False And CheckBox3.Value =
False And CheckBox36.Value = False And CheckBox38.Value = False Then

MsgBox "Please check reason for request!"
Range("A11").Select

End If

I receive the msgbox, but when I click ok, the form is emailed even though
there isn't any checkboxes checked. I think I need code after the msgbox
line but I am not sure how to do this. Can someone help me?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Validating checkboxes

Thanks! Works great.

"JNW" wrote:

See change below.

If CheckBox1.Value = False _
And CheckBox2.Value = False _
And CheckBox3.Value = False _
And CheckBox36.Value = False _
And CheckBox38.Value = False Then

MsgBox "Please check reason for request!"
Range("A11").Select
Exit sub '<<<<<Add this
End If

--
JNW


"Tammy H" wrote:

Hi All,
I have an Excel sheet that has several checkboxes. I also have a command
button that when clicked the form is emailed. When the user clicks the
cammand button I need to verify that at least one checkbox in each category
is checked before the form is emailed. I tried something like:

If CheckBox1.Value = False And CheckBox2.Value = False And CheckBox3.Value =
False And CheckBox36.Value = False And CheckBox38.Value = False Then

MsgBox "Please check reason for request!"
Range("A11").Select

End If

I receive the msgbox, but when I click ok, the form is emailed even though
there isn't any checkboxes checked. I think I need code after the msgbox
line but I am not sure how to do this. Can someone help me?



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
Validating a Cell Lady Success Excel Worksheet Functions 1 September 25th 08 06:05 PM
validating Philashley Excel Discussion (Misc queries) 2 March 13th 08 03:54 PM
validating Ayesha Excel Worksheet Functions 2 April 26th 06 02:56 PM
Validating Sdbenn90 Excel Discussion (Misc queries) 0 March 27th 06 12:05 AM
Validating in VBA Casey C Excel Programming 7 November 25th 05 08:22 PM


All times are GMT +1. The time now is 02:10 AM.

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"