Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



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
Filter rows on sheet 2 when a certain option is chosen on sheet 1 GIP Excel Worksheet Functions 1 August 19th 10 07:48 PM
Formula to point to another cell if an option is chosen. Peggy Excel Worksheet Functions 2 January 30th 08 08:28 PM
Font different than one chosen Bruce Excel Discussion (Misc queries) 2 February 14th 07 03:04 PM
How do I let only one box be chosen when there are several? alruslavage Excel Worksheet Functions 7 May 10th 05 04:09 PM
User Option to save to chosen destination patterson_m[_4_] Excel Programming 1 October 13th 03 05:41 PM


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

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

About Us

"It's about Microsoft Excel"