Help with OptionButtons on a Userform

  • Thread starter Thread starter Robert Crandal
  • Start date Start date
R

Robert Crandal

I created my first Userform with a pair of OptionButtons.
So there two option buttons in my group and I need to
know how to set or check one of the option buttons
before or when the userform loads. How would I do this??

Btw, the option that gets set is going to depend on the
contents of cell A1. so if cell A1 contains integer value of
1, then i want OptionButton1 to be set. If A1 == 2, then
I want OptionButton2 to be set or checked.

thank you.
 
I created my first Userform with a pair of OptionButtons.
So there two option buttons in my group and I need to
know how to set or check one of the option buttons
before or when the userform loads. How would I do this??

Btw, the option that gets set is going to depend on the
contents of cell A1. so if cell A1 contains integer value of
1, then i want OptionButton1 to be set. If A1 == 2, then
I want OptionButton2 to be set or checked.

thank you.


Try this macro

Private Sub UserForm_Activate()
If Worksheets("Sheet1").Cells(1, "A").Value = 1 Then
OptionButton1.Value = True
End If
If Worksheets("Sheet1").Cells(1, "A").Value = 2 Then
OptionButton2.Value = True
End If
End Sub

Hope this helps / Lars-Åke
 
Back
Top