Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validating a Cell | Excel Worksheet Functions | |||
validating | Excel Discussion (Misc queries) | |||
validating | Excel Worksheet Functions | |||
Validating | Excel Discussion (Misc queries) | |||
Validating in VBA | Excel Programming |