Very New to Excel. How do I make a Userform?
Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

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

  1. #1
    Guest

    Default

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

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,936
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sunny, spring-like Hull
    Posts
    3,339
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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!

  4. #4
    Guest

    Default

    Thanks. Learned a LOT today!

  5. #5
    Board Regular Brian from Maui's Avatar
    Join Date
    Feb 2002
    Posts
    8,445
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    So did I!!!


User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com