![]() |
validate an option is chosen
I have 2 option buttons in a form. The worksheet is
emailed with a macro. How can I validate in my macro that one of the option buttons has been selected. In other words I would like a message box to pop up saying "You must make a selection before emailing" if the user does not select one of the option buttons. thanks |
validate an option is chosen
You can validate the values by nesting IF Statements at the beginning of your code... HTH Owen If Sheet1.OptionButton1 = Sheet1.OptionButton2 Then If Sheet1.OptionButton2 = False Then Dim lMsg As Long lMsg = MsgBox("Select an Option Fool", vbOKOnly + vbExclamation, "No Selection Made") End If End If -----Original Message----- I have 2 option buttons in a form. The worksheet is emailed with a macro. How can I validate in my macro that one of the option buttons has been selected. In other words I would like a message box to pop up saying "You must make a selection before emailing" if the user does not select one of the option buttons. thanks . |
validate an option is chosen
Dave,
One way for forms option buttons If ActiveSheet.OptionButtons("Option Button 1").Value = xlOff And _ ActiveSheet.OptionButtons("Option Button 2").Value = xlOff Then MsgBox "One must be selected" End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "DaveB" wrote in message ... I have 2 option buttons in a form. The worksheet is emailed with a macro. How can I validate in my macro that one of the option buttons has been selected. In other words I would like a message box to pop up saying "You must make a selection before emailing" if the user does not select one of the option buttons. thanks |
validate an option is chosen
Worked great, Much appreciated.
-----Original Message----- You can validate the values by nesting IF Statements at the beginning of your code... HTH Owen If Sheet1.OptionButton1 = Sheet1.OptionButton2 Then If Sheet1.OptionButton2 = False Then Dim lMsg As Long lMsg = MsgBox("Select an Option Fool", vbOKOnly + vbExclamation, "No Selection Made") End If End If -----Original Message----- I have 2 option buttons in a form. The worksheet is emailed with a macro. How can I validate in my macro that one of the option buttons has been selected. In other words I would like a message box to pop up saying "You must make a selection before emailing" if the user does not select one of the option buttons. thanks . . |
All times are GMT +1. The time now is 11:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com