Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Test a grouping of OptionButtons

I have 4 OptionButton groups each group has a GroupName property set

Changed
Changed2
Changed3
Changed4

Is there any way to test a group and if all OptionButtons within that group
are false to display a message telling the user that they must select one of
the 6 options?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Test a grouping of OptionButtons

Try something like this

Sub test()

Set MyFrame = UserForm1.Frame1

Istrue = False
For Each but In MyFrame.Controls
If but.Value = True Then
Istrue = True
Exit For
End If
Next

If Istrue = False Then
MsgBox ("select a button in Frame 1")
End If

End Sub


"Patrick C. Simonds" wrote:

I have 4 OptionButton groups each group has a GroupName property set

Changed
Changed2
Changed3
Changed4

Is there any way to test a group and if all OptionButtons within that group
are false to display a message telling the user that they must select one of
the 6 options?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Test a grouping of OptionButtons

Is there any way to adjust that so that it checks each Group separately so
that I can display a different message for each group, so the user will know
which set of option buttons they need to look at?



"Joel" wrote in message
...
Try something like this

Sub test()

Set MyFrame = UserForm1.Frame1

Istrue = False
For Each but In MyFrame.Controls
If but.Value = True Then
Istrue = True
Exit For
End If
Next

If Istrue = False Then
MsgBox ("select a button in Frame 1")
End If

End Sub


"Patrick C. Simonds" wrote:

I have 4 OptionButton groups each group has a GroupName property set

Changed
Changed2
Changed3
Changed4

Is there any way to test a group and if all OptionButtons within that
group
are false to display a message telling the user that they must select one
of
the 6 options?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Test a grouping of OptionButtons

Thanks I figured it out

"Patrick C. Simonds" wrote in message
...
Is there any way to adjust that so that it checks each Group separately so
that I can display a different message for each group, so the user will
know which set of option buttons they need to look at?



"Joel" wrote in message
...
Try something like this

Sub test()

Set MyFrame = UserForm1.Frame1

Istrue = False
For Each but In MyFrame.Controls
If but.Value = True Then
Istrue = True
Exit For
End If
Next

If Istrue = False Then
MsgBox ("select a button in Frame 1")
End If

End Sub


"Patrick C. Simonds" wrote:

I have 4 OptionButton groups each group has a GroupName property set

Changed
Changed2
Changed3
Changed4

Is there any way to test a group and if all OptionButtons within that
group
are false to display a message telling the user that they must select
one of
the 6 options?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Test a grouping of OptionButtons

I would make the code a function like below. Change the MyFrame Array to
match all your frames.

Function FrameCheck() As Boolean

FrameError = False
MyFrames = Array("Frame1", "Frame2", "Frame3")
For Each FrmName In MyFrames
Set MyFrame = UserForm1.Controls(FrmName)
Itrue = False
For Each but In MyFrame.Controls
If but.Value = True Then
FrameError = True
Istrue = True
Exit For
End If
Next

If Istrue = False Then
MsgBox ("select a button in " & FrmName)
End If

Next FrmName

FrameCheck = FrameError
End Function




"Patrick C. Simonds" wrote:

Is there any way to adjust that so that it checks each Group separately so
that I can display a different message for each group, so the user will know
which set of option buttons they need to look at?



"Joel" wrote in message
...
Try something like this

Sub test()

Set MyFrame = UserForm1.Frame1

Istrue = False
For Each but In MyFrame.Controls
If but.Value = True Then
Istrue = True
Exit For
End If
Next

If Istrue = False Then
MsgBox ("select a button in Frame 1")
End If

End Sub


"Patrick C. Simonds" wrote:

I have 4 OptionButton groups each group has a GroupName property set

Changed
Changed2
Changed3
Changed4

Is there any way to test a group and if all OptionButtons within that
group
are false to display a message telling the user that they must select one
of
the 6 options?


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
Moving OptionButtons MarkyB Excel Discussion (Misc queries) 2 March 7th 06 02:50 PM
Selecting OptionButtons Geoff Excel Programming 9 July 16th 05 06:55 PM
Grouping OptionButtons post-creation Ed Excel Programming 2 December 11th 03 10:33 PM
OptionButtons Paul Excel Programming 4 December 4th 03 04:12 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


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

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"