Here you use one of the "functions" of VBA. If you reference some objects, such as a select button, without the specified property, VBA assumes that you want the default property, not the object itself. In the case of the select button, the default property is .Value, so in your code OptionButton1 is not the object of the option button, but rather TRUE or FALSE, depending on whether OptionButton1 is checked.
:
Private Function Option1Checked(option1 As Boolean) As Integer
//option1.ForeColor = vbGreen
If (option1 = True) Then
Option1Checked = 1
Else
Option1Checked = 0
End If
End Function
, , .
, , , .
Private Function Option1Checked(ByVal option1 As String) As Integer
UserForm1.Controls(option1).ForeColor = vbGreen
If (UserForm1.Controls(option1) = True) Then
Option1Checked = 1
Else
Option1Checked = 0
End If
End Function
Sub MyCountingRoutine()
Dim str As String
str = OptionButton1.Name
counter = counter + Option1Checked(str)
End Sub
, Else If..Then , 0 .