Nested For Each Statement
try this
i = 10
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
i = i +1
End If
Next icell
--
When you lose your mind, you free your life.
"V. Roe" wrote:
Yes I am trying to set a single optionbutton to a single set of initials. I
want the user to select their intials using the optionbutton.
Thank you
"ben" (remove this if mailing direct) wrote in message
...
something i just noticed about your code.
The way you have the for next loops set up. each cell will change each
optionbutton NUMEROUS TIMES. optionbutton10 will change for how many ever
cells you have in your "InitialList" range. are you trying to assign each
cell taht contains a SINGLE SET OF initials to a SINGLE Option Button?
Ben
--
When you lose your mind, you free your life.
"V. Roe" wrote:
I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton in a group
of
optionbuttons on a userform. I cannot get the loop sequence correct. I
have tried several variations of the code below, but I cannot get it to
change to the next optionbutton. Any help would be greatly appreciated.
I
am using excel 97.
For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i
|