Private Sub CommandButton1_Click()
If Me.OptionButton1 = True Then
MsgBox Me.OptionButton1.Name
ElseIf Me.OptionButton2 = True Then
MsgBox Me.OptionButton2.Name
ElseIf Me.OptionButton3 = True Then
MsgBox Me.OptionButton3.Name
ElseIf Me.OptionButton4 = True Then
MsgBox Me.OptionButton4.Name
ElseIf Me.OptionButton5 = True Then
MsgBox Me.OptionButton5.Name
ElseIf Me.OptionButton6 = True Then
MsgBox Me.OptionButton6.Name
ElseIf Me.OptionButton7 = True Then
MsgBox Me.OptionButton7.Name
ElseIf Me.OptionButton8 = True Then
MsgBox Me.OptionButton8.Name
End If
End Sub
Private Sub CommandButton1_Click()
Dim mycontrol As Control
on error resume next
For Each mycontrol In Me.Controls
If TypeName(mycontrol) = "OptionButton" then
if mycontrol.Value = true Then
MsgBox mycontrol.Name & "-----" & mycontrol.caption
Exit For
end if
End If
Next
End Sub