View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Specifying Item number of control on user form

What did you want to do with the OptionButtons currently numbered 10, 11,
12, etc. then? If you automatically bump their number's up, wont' that screw
up your code? Why aren't you using the GroupName property to group your
controls (then the numbers wouldn't matter)? I presume when you say "cycle
them", I presume you mean 'in code'. You would do that by examining the
GroupName in your loop. For example, if the GroupName for one grouping of
OptionButtons was "MyFirstGroup", then you could cycle each one with code
like this...

Dim C As Control
For Each C In Me.Controls
If TypeOf C Is msForms.OptionButton Then
If C.GroupName = "MyFirstGroup" Then
Debug.Print C.Name
End If
End If
Next

--
Rick (MVP - Excel)


"Mark Stephens" wrote in message
...
I have a number of controls on my user form and am cycling through them.
The problem I have is that whenever I decide to add a new member to the
group (frequently) it is given the item number according to the order it
waqs placed on the page (i.e. if it is the 50th control number 50) when I
want it to be (for exxample) number 10 since it an addition to an existing
1-9 option buttons and I want to cycle them.

Sure I can cut every other control and repaste it and then the item number
is as i want it but hopefully there is a more elegant solution ... anyone?

Thanks and regards, Mark