opening a user form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have created a user form but
1) how do i get it to run once i opened the excel file
2) the user form will populate the data into a worksheet , but how do i make
that worksheet to get the focus after the populate process

appreciate any advise

tks & rdgs
 
Assuming your userform is named UserForm1 . . . add this macro to a standard
module to open the form:

Sub OpenForm
UserForm1.Show
End Sub

To get back to the worksheet, use this line of code to close the user form:

Unload Me

For example, if you wanted to close the form with a command button:

Private Sub CommandButton1_Click()
Unload Me
End Sub
 
To get back to the worksheet, use this line of code to close the user form:

Unload Me

For example, if you wanted to close the form with a command button:

Private Sub CommandButton1_Click()
Unload Me
End Sub

Note that this is a command button on the form, the unload must be effected
from the form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top