How do you move UserForm to Right hand side of screen with VBA?

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

The Userform usually come up in the center of the screen.

Given that different users have different resolutions on their screens how do
you move the Userform to the right hand side of the screen with it being
centered vertically no matter what the user screen resolution is?

Thanks

Dennis
 
Hi Dennis

Try this in the userform module

Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = (Application.Height / 2) - Me.Height / 2
Me.Left = Application.Width - Me.Width + Application.Left
End Sub
 
Thanks Ron that worked.

I had to change the Me.Left to clear the scroll bar on the right to:

Me.Left = Application.Width - Me.Width + Application.Left - 20

Thanks again.

Dennis
 

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