Show Form on Button Click

Vampy99

New Member
Joined
Jul 13, 2011
Messages
42
Hi,

I've created a form in visual basic & have created a button on my first worksheet, how do I get the form to pop-up by clicking the button?

Just to warn you, I'm a complete beginner when it comes to VB, this is my first project.

Thanks in advance.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
If you attach a macro to the button (different depending where the button is from) and the line:-
userform1.show

Will make your userform appear. You may need to change Userform1 depending on the name of your userform.
 
Upvote 0
With an ActiveX button from the Controls toolbar

Code:
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
 
Upvote 0
Thanks for the responses guys.

However, it is still not working for me, I keep getting the error 422, object required :(
 
Upvote 0
Do you get an option to debug?

Is there Userform_Initialize code? If so please post it.
 
Upvote 0
Do you get an option to debug?

Is there Userform_Initialize code? If so please post it.

Private Sub UserForm_Initialize()

ListBoxServices.Clear

With ComboDay

.AddItem "01"
.AddItem "02"
.AddItem "03"
.AddItem "04"
.AddItem "05"
.AddItem "06"
.AddItem "07"
.AddItem "08"
.AddItem "09"
.AddItem "10"
.AddItem "11"
.AddItem "12"
.AddItem "13"
.AddItem "14"
.AddItem "15"
.AddItem "16"
.AddItem "17"
.AddItem "18"
.AddItem "19"
.AddItem "20"
.AddItem "21"
.AddItem "22"
.AddItem "23"
.AddItem "24"
.AddItem "25"
.AddItem "26"
.AddItem "27"
.AddItem "28"
.AddItem "29"
.AddItem "30"
.AddItem "31"

End With

With ComboMonth

.AddItem "01"
.AddItem "02"
.AddItem "03"
.AddItem "04"
.AddItem "05"
.AddItem "06"
.AddItem "07"
.AddItem "08"
.AddItem "09"
.AddItem "10"
.AddItem "11"
.AddItem "12"

End With

With ComboYear


.AddItem "2011"
.AddItem "2012"

End With

End Sub


The debugger just takes me to the userform1.show line :confused:
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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