Userform - placing

  • Thread starter Thread starter Mette
  • Start date Start date
M

Mette

Hi,

I have created a userform which startups when the file opens.

I would like a specific placement different from the standard.

How do I have it to startup with its left corner in A18 for instance?

Mette
 
Select the form in VB, and Change the StartUpPosition to manual.

Then place the required position in the LEFT=


Corey....
 
Hi Corey

Thanks for your answer.

I have tried this:

Load UserForm1
UserForm1.StartUpPosition = 0
UserForm1.Left = -30
UserForm1.Top = 20

UserForm1.Show

but nothing is changed. The UserForm still pop up in the middle of the
screen. What am I doing wrong?

"corey" skrev:
 
hi,

Right click your userform, View code and paste this in. Play with the
numbers to position it where you want.

Private Sub UserForm_Activate()
With UserForm1
.Top = Application.Top + 300 'Top - Bottom
.Left = Application.Left + 25 'Left - Right
End With
End Sub

Mike
 
Hi Corey

Thanks for your answer.

I have tried this:

Load UserForm1
UserForm1.StartUpPosition = 0
UserForm1.Left = -30
UserForm1.Top = 20

UserForm1.Show

but nothing is changed. The UserForm still pop up in the middle of the
screen. What am I doing wrong?

"corey" skrev:

That code works fine. Where have you put it?
 
Hi Duncan

I have put it in a Private Sub in another sheet (and also in the Private sub
Workbook_Open):

Private Sub CommandButton2_Click()
Sheets("Porteføljesammensætning").Select

Load UserForm1
UserForm1.StartUpPosition = 0
UserForm1.Left = -50
UserForm1.Top = 20

UserForm1.Show
End Sub

and it still pop up in the middle of the screen.

Mette

"Duncan" skrev:
 
Hi Duncan

I have put it in a Private Sub in another sheet (and also in the Private sub
Workbook_Open):

Private Sub CommandButton2_Click()
Sheets("Porteføljesammensætning").Select

Load UserForm1
UserForm1.StartUpPosition = 0
UserForm1.Left = -50
UserForm1.Top = 20

UserForm1.Show
End Sub

and it still pop up in the middle of the screen.

Mette

"Duncan" skrev:



Just done the same;

Private Sub CommandButton1_Click()

Worksheets("sheet1").Select
Load UserForm1
UserForm1.StartUpPosition = 0

UserForm1.Left = -50
UserForm1.Top = 20

UserForm1.Show

End Sub

Works no problems in Excel 2003 so your code is fine. Try adding an
extra line before the Show command;

msgbox "Left = " & str(userform1.left) & ", Top = " &
str(userform1.top)

...to see that it is getting this far ok.
 
Thanks! It works fine.


"Mike H" skrev:
hi,

Right click your userform, View code and paste this in. Play with the
numbers to position it where you want.

Private Sub UserForm_Activate()
With UserForm1
.Top = Application.Top + 300 'Top - Bottom
.Left = Application.Left + 25 'Left - Right
End With
End Sub

Mike
 

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