Hello Everyone,
Im using Excel 2013 and am trying to center a label in a UserForm, and keep it centered even if the width of the userform changes.
I manipulated the example from this thread https://www.mrexcel.com/forum/excel-questions/837057-center-label-userform.html, but with no luck. Any help would be greatly appreciated.
Im using Excel 2013 and am trying to center a label in a UserForm, and keep it centered even if the width of the userform changes.
I manipulated the example from this thread https://www.mrexcel.com/forum/excel-questions/837057-center-label-userform.html, but with no luck. Any help would be greatly appreciated.
Code:
Private Sub UserForm_Activate()
With LendStart
.Height = 177
.Width = 642
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Caption = "Get Started"
End With
Select Case Time
Case Is < 0.5
With LendStart.Label1
.AutoSize = False
.Font.Size = 12
.Font.Bold = True
.Caption = "Good Morning " & Split(Application.UserName)(0) & "!"
.TextAlign = fmTextAlignCenter
.Left = LendStart.Left + (0.5 * LendStart.Width) - (0.5 * LendStart.Width)
.AutoSize = True
End With