Question : excel vba center userform
Answered by : vastemonde
' On application window
Private Sub UserForm_Initialize() Me.Top = Application.Top + (Application.UsableHeight / 2) - (Me.Height / 2) Me.Left = Application.Left + (Application.UsableWidth / 2) - (Me.Width / 2)
End Sub
' Or
With myForm .StartUpPosition = 0 ' Manual .StartUpPosition = 1 ' CenterOwner .StartUpPosition = 2 ' CenterScreen .StartUpPosition = 3 ' WindowsDefault, screen top left
End With
Source : https://bettersolutions.com/vba/userforms/positioning.htm | Last Update : Sun, 14 Feb 21