excel vba center userform

The solution for “excel vba center userform” can be found here. The following code will assist you in solving the problem.

‘ 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

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts