Help with Option Button

Hershel

New Member
Joined
Jun 3, 2012
Messages
3
Hi! I need a little help about option buttons:
I've this User Form:

270839_10150832047931816_721631492_n.jpg





and the cod on the command button is:
Private Sub CommandButton_Click()
If OptionButton1 = True Then
If OptionButton4 = True Then
Welcome.Hide
UserForm1.Show
Load UserForm1
ElseIf OptionButton5 = True Then
Welcome.Hide
Load UserForm2
UserForm2.Show
ElseIf OptionButton6 = True Then
Welcome.Hide
Load UserForm3
UserForm3.Show
End If
End If
End Sub
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I noticed that the Load UserForm1 line comes after the UserForm1.Show line, unlike userform2 or 3.

Is this a typo?
 
Upvote 0
As a beginner I will tell you that it works either way. Maybe a pro can tell another answer...
 
Upvote 0
Personaly, if I'm going to show a Userform, I don't use the Load statement.

As far as I can see, Showing isn't nesseary, simply referencing a Userform loads it. It is useful in situations where you have multiple instances of the same userform, but normaly I don't find Load useful.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top