LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Looping thru sub-level of controls on userform

on this multipage, i have textboxes that i loop thru to make sure
something's in them. Ok, fine.

then i have a bunch of frames. within the frames are option buttons.
i want to make sure one option button is selected in each frame.

in a previous project somebody gave me the code to do this BUT there
were ONLY frames with option buttons, so i just looped through all the
option buttons. i could do it that way again, by labeling option
buttons with tags (some are hidden, only to be used sometimes, and are
not in this looping counting business. this is what i've got so far
but my theory is wrong somehow.........

====================

'make sure an option button is checked in each
'frame that's visible & used

Dim oControl As Control
Dim bControl As Control
Dim i as Integer

i = 0

For Each oControl In Me.Controls
If TypeOf oControl Is msforms.Frame Then
If oControl.Tag = "CountMe" Then
For Each bControl In oControl
If TypeOf bControl Is msforms.OptionButton Then
If bControl Then
i = i + 1
End If
End If
Next bControl
End If
End If
Next oControl

If i < 5 Then 'something's missing
MsgBox "Every frame must have a selected option button!" _
& vbCrLf & _
vbCrLf & _
"Please go back and answer all the questions." _
, vbOKOnly + vbExclamation
Exit Sub
End If
=========================
any ideas on how to make this theory work? or perhaps it wont & i'll
have to tag each option button individually..........
thanks!
susan

 
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
looping through controls cmpcwil2[_4_] Excel Programming 4 April 18th 06 10:48 AM
Looping through controls Libby Excel Programming 1 April 27th 05 04:13 PM
Problem with looping through userform controls Jeremy Gollehon[_2_] Excel Programming 5 February 17th 05 05:41 PM
looping through userform controls JulieD Excel Programming 2 August 14th 04 02:13 PM
looping through userform controls changing enabled and locked properties JulieD Excel Programming 2 August 14th 04 12:44 PM


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