Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default cycle thru controls

My multitab user form as 8 tabs. Each tab has a different number of radio
buttons. Is there an easy way to cycle through all of the radio buttons on a
single tab to find the one that has been selected?

Currently I'm, writing an "if" statement for each radio button but this
seems cumbersome.

Thanks.......
--
JT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default cycle thru controls

On Sep 10, 5:02 pm, JT wrote:
My multitab user form as 8 tabs. Each tab has a different number of radio
buttons. Is there an easy way to cycle through all of the radio buttons on a
single tab to find the one that has been selected?

Currently I'm, writing an "if" statement for each radio button but this
seems cumbersome.

Thanks.......
--
JT


The below is some code I have for cycling through the controls in a
frame (in this case to disable/enable). You could modify to only look
for radiobuttons that = true.

Sub EnableFrame(InFrame As Frame, ByVal Flag As Boolean)
Dim Contrl As Control
'some controls don't have the Container.Name property, so instead of
'stopping the application with an error message, we ignore them.
On Error Resume Next
'enable or disable the frame that passed as parameter.
InFrame.Enabled = Flag
'passing over all controls
For Each Contrl In InFrame.Parent.Controls
'if the control is found in the frame
If (Contrl.Container.Name = InFrame.Name) Then
'if the control is a frame, and it's not the frame that passed as
parameter, i.e.
'other frame that found inside our frame, recursively run this sub
with this frame,
'to enable or disable all the controls in it.
If (TypeOf Contrl Is Frame) And Not (Contrl.Name =
InFrame.Name) Then
EnableFrame Contrl, Flag
Else
'enable or disable the control
If Not (TypeOf Contrl Is Menu) Then Contrl.Enabled = Flag
End If
End If
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default cycle thru controls

This checks Page3 of the mulripage

With MultiPage1.Pages(2)
For Each ctl In .Controls
If TypeName(ctl) = "OptionButton" Then
If ctl.Value Then
MsgBox ctl.Name
Exit For
End If
End If
Next ctl
End With


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"JT" wrote in message
...
My multitab user form as 8 tabs. Each tab has a different number of radio
buttons. Is there an easy way to cycle through all of the radio buttons
on a
single tab to find the one that has been selected?

Currently I'm, writing an "if" statement for each radio button but this
seems cumbersome.

Thanks.......
--
JT




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
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? Charles A. Wilson Charts and Charting in Excel 1 December 17th 09 03:03 AM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
Event procedures for controls added with Controls.Add John Austin[_4_] Excel Programming 1 March 9th 05 03:31 PM
Cycle through controls with similar names Tim Archer[_2_] Excel Programming 1 January 27th 05 12:13 PM


All times are GMT +1. The time now is 05: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"