ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Optionbutton Group test (https://www.excelbanter.com/excel-programming/429806-re-optionbutton-group-test.html)

Bob Umlas[_3_]

Optionbutton Group test
 
Private Sub Commandbutton1_Click()
Dim x As Control
For Each x In Me.Controls
If TypeName(x) = "OptionButton" Then If x.Value = True Then GoTo OK
Next
MsgBox "none"
Exit Sub
OK:
MsgBox "good"
End Sub


"Patrick C. Simonds" wrote in message
...
I have 7 OptionButtons on my UserForm. They are all have the same GoupName,
which is Status. Is there any way to test the Group to ensure at least 1
option is selected.

What I am looking for is a msgbox to popup saying "You must select at
least 1 option prior to continuing"

I know I can use an If Statement to check each OptionButton but thought it
would be cleaner if I could just check the Group.





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com