refering to option buttions

M

mark kubicki

i want to refer to 1 of several option buttons.
the choice of which button is determined by the value stored as a named
range (EmployeePosition)...

in the following, if the value of Employee Range = "Assoc",
i would want the value of the option button: obAssoc on UserForm1 to be true

Dim obEmployeePostion As Object
obEmployeePosition = "ob" & [EmployeePosition]
Load UserForm1
UserForm1.obEmployeePosition.Value = True
End Sub

......
doesn't seem to be the right approach...
thanks in advance, mark
 
C

Cliff Myers

Where are you storing EmployeePosition, cell, textbox?
If cell then you can use:
'cells(1,1) refers to cell A1
If Cells(1,1) = "Assoc" Then
Load UserForm1
UserForm1.obEmployeePosition.Value = True
End If

If you are using a TextBox then you can use:
If Textbox1.value = "Assoc" Then
Load UserForm1
UserForm1.obEmployeePosition.Value = True
End If
HTH
 
M

mark kubicki

as a "NAME" (XL/insert/names... but created/stored thru VBA, names.add...
refers to...)

note:
the option buttion is reffered to as ob+(the value stored in the "NAME":
EmployeePosition
ex: if EmployeePosition stored the value Assoc, the option button is obAssoc
in the "NAME"(EmployeePositon) only the description of the actual position
is stored; i need to add the prefix "ob" to correctly refer to the object
option button

....my though is that this way i could concatenate the value of (Employee
Position) with different prefixes to access different stuff all relating to
that value

(is this confusing?)

Cliff Myers said:
Where are you storing EmployeePosition, cell, textbox?
If cell then you can use:
'cells(1,1) refers to cell A1
If Cells(1,1) = "Assoc" Then
Load UserForm1
UserForm1.obEmployeePosition.Value = True
End If

If you are using a TextBox then you can use:
If Textbox1.value = "Assoc" Then
Load UserForm1
UserForm1.obEmployeePosition.Value = True
End If
HTH
mark kubicki said:
i want to refer to 1 of several option buttons.
the choice of which button is determined by the value stored as a named
range (EmployeePosition)...

in the following, if the value of Employee Range = "Assoc",
i would want the value of the option button: obAssoc on UserForm1 to be true

Dim obEmployeePostion As Object
obEmployeePosition = "ob" & [EmployeePosition]
Load UserForm1
UserForm1.obEmployeePosition.Value = True
End Sub

.....
doesn't seem to be the right approach...
thanks in advance, mark
 
Top