userform

bibstar03

New Member
Joined
Jan 30, 2003
Messages
25
I have created a userform using vb, but how can i view it over my worksheet? at the moment i can only view the form by going into vb

thanks
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

soberguy

New Member
Joined
Nov 28, 2005
Messages
13
The way I did this was by adding an auto shape, like drawing a circle or oval. Right click on that object, and select "assign macro." Click on "New" and your code for this "button" will be
Code:
Sub AutoShape1_Click()
    UserForm.Show
End Sub
NOTE: UserForm will be the name of whatever your userform is named. For example, my user form is used to add names to a list, so I call it AddForm. Thus, my code is:
Code:
Sub AutoShape1_Click()
    AddForm.Show
End Sub

Hope that helps
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Each UserForm you create is given an index number this number is amended to the generic form name: UserForm

So your 1st UserForm's name will be: UserForm1
and your 2nd one will be: UserForm2

To open your form for display you need to call the correct form from another Sub. To do this you can use any Module. Typically, if you want to Show your form on any Sheet in your Workbook you would place your Show Sub in a Standard module, like: Module1.

If you will only be showing your form on a certain Sheet, then you will store the Show Sub code in a Sheet Module, like: Sheet1.


The general Sub to do this is:

Sub myForm()

UserForm1.Show
End Sub


P.S: Technically "VB" is the language of Visual Basic, Microsoft Office products use a sub-set of VB known as VBA "Visual Basic for Applications." This sub-set contains things that only apply to office products, so they are not needed in the general VB language.

So if you can only view your form in "vb" you really mean: I can only view my UserForm in the VBA Editor or "VBE" for short!
 

Watch MrExcel Video

Forum statistics

Threads
1,118,033
Messages
5,569,777
Members
412,291
Latest member
marypolitan
Top