Chuck Moran
New Member
- Joined
- May 12, 2011
- Messages
- 7
Good morning,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Currently using: Excel 2007
<o> </o>
I use a spreadsheet with forms for selecting specific information. There are multiple frames and many OptionButtons on each the frames.
<o> </o>
The OptionButton.Captions are set by the following code and it works OK:
<o> </o>
<o> </o>
Sub SetupWireInspectorSheet()
If Range("LISTS!a2") = "" Then
UserForm2.OptionButton131.Visible = False
Else: UserForm2.OptionButton131.Caption = Range("LISTS!a2")
End If
If Range("LISTS!a3") = "" Then
UserForm2.OptionButton132.Visible = False
Else: UserForm2.OptionButton132.Caption = Range("LISTS!a3")
End If
…
Exit Sub
<o> </o>
There are over 100 OptionButtons and the code is very lengthy. I’d like to shorten the code.
<o> </o>
Can someone tell me how to create a LOOP that will:
1 – increment the # of the OptionButton portion of the above code
2 – increment the # of the Range portion of the above code – is it different since it is inside quotes
<o> </o>
Thank you,
Chuck
</SPAN></SPAN>
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Currently using: Excel 2007
<o> </o>
I use a spreadsheet with forms for selecting specific information. There are multiple frames and many OptionButtons on each the frames.
<o> </o>
The OptionButton.Captions are set by the following code and it works OK:
<o> </o>
<o> </o>
Sub SetupWireInspectorSheet()
If Range("LISTS!a2") = "" Then
UserForm2.OptionButton131.Visible = False
Else: UserForm2.OptionButton131.Caption = Range("LISTS!a2")
End If
If Range("LISTS!a3") = "" Then
UserForm2.OptionButton132.Visible = False
Else: UserForm2.OptionButton132.Caption = Range("LISTS!a3")
End If
…
Exit Sub
<o> </o>
There are over 100 OptionButtons and the code is very lengthy. I’d like to shorten the code.
<o> </o>
Can someone tell me how to create a LOOP that will:
1 – increment the # of the OptionButton portion of the above code
2 – increment the # of the Range portion of the above code – is it different since it is inside quotes
<o> </o>
Thank you,
Chuck
</SPAN></SPAN>