Very New to Excel. How do I make a Userform?

G

Guest

Guest
I hear everyone talk about how great a userform is. How (in simple terms) do I make one?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Quite simple, once you've got the hang of it. Here's a quick guide:-


Open the VB Editor (Alt+F11) and choose Insert, Userform. This will create a blank userform which you can add controls to. Make sure the Toolbox is visible (View, Toolbox) and then click the Textbox control (the one with ab| on it) and then click the userform. This will add a textbox to your userform. Then do the same with the command control (the grey rectangle). Double click the command button. This should create a blank procedure for CommandButton1_Click. Type this:-

Private Sub CommandButton1_Click()
MsgBox "The text entered in the textbox was " & Me.TextBox1.Text
End Sub

Now press F5 (run), type something in the textbox and press the command button. You should see a message telling you what you typed into the textbox. Congratulations! You've created a userform!

You can show the userform from a macro by doing this:-

Sub Test()
Userform1.Show
End Sub

HTH,
D
This message was edited by dk on 2002-03-08 11:38
 
Upvote 0
To create one, open up the VBA editor by pressing Alt-F11. You'll see a code window on the right and the Project Explorer window on the left with the names of your worksheets and an entry of ThisWorkbook.

Click on Insert and UserForm, this puts up a blank form and opens up the userform toolbox (if you lose the toolbox, either click on View- Toolbox or click the little hammer icon at the top). You can now 'draw' controls onto the UserForm.

Depending on what you want to do, you may have a textbox for people to enter stuff, a listbox that they can pick options from, command buttons to exit the form or start another process running etc.

Once you've drawn your contols on there right-click on any of them and select properties, you can then change thrie appearance etc. Press F5 to run the form. Now all you have to do is decide what you want to do with it! :)
 
Upvote 0

Forum statistics

Threads
1,213,492
Messages
6,113,967
Members
448,537
Latest member
Et_Cetera

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