Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Help with OptionButtons on a Userform

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default Help with OptionButtons on a Userform

On Fri, 27 Nov 2009 20:55:15 -0700, "Robert Crandal"
wrote:

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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm OptionButtons Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 3 October 4th 07 07:52 PM
Hiding/Showing OptionButtons on a UserForm ryguy7272 Excel Programming 5 August 2nd 07 02:56 PM
CommandButtons and OptionButtons on Userform Mike Excel Programming 9 March 21st 07 02:44 AM
Need help creating a userform with optionbuttons TB[_2_] Excel Programming 2 July 21st 03 02:16 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


All times are GMT +1. The time now is 10:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"