Is there a way to find out which option button on a worksheet is selected by looping through an option button array? I remember doing something like this in VB5. I'm trying to do the same in VBA in Excel now but can't make the button names an array. Right now I have to check each button individually for a true value. Works OK with 2 or 3 buttons but with more it gets cumbersome.
[tt]
If OptionButton1 Then
gSystem = 1
ElseIf OptionButton2 Then
gSystem = 2
Else
gSystem = 3
End If
[/tt]
Can't you do something like this?
[tt]
For i = 1 to 3
if optionbutton(i) Then
gSystem = i
end if
Next i
[/tt]
[tt]
If OptionButton1 Then
gSystem = 1
ElseIf OptionButton2 Then
gSystem = 2
Else
gSystem = 3
End If
[/tt]
Can't you do something like this?
[tt]
For i = 1 to 3
if optionbutton(i) Then
gSystem = i
end if
Next i
[/tt]