ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform to appear in the center of the screen (https://www.excelbanter.com/excel-programming/379976-re-userform-appear-center-screen.html)

JMay

userform to appear in the center of the screen
 
The following code needs to be pasted into the Code
Behind your Userform:

Private Sub UserForm_Initialize()
Me.Left = Application.Width / 2 - Me.Width / 2
Me.Top = Application.Height / 2 - Me.Height / 2
End Sub

Write back if you encounter problems;

Jim

"ernie" wrote in message
:

how can i get my userform to appear in the center of the screen even if i
change my screen resolution settings. i use the code below with screen
resolution of 1024 by 768 pixels.

Private Sub Workbook_Open()
Application.WindowState = xlNormal
Application.Top = 250
Application.Left = 320
Application.Height = 1
Application.Width = 1
End Sub
--
Thank you for your help i appreciate it.
Ernie




All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com