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
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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
 
Upvote 0
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!
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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