Userform Positioning at Top-Left of Worksheet

animas

Active Member
Joined
Sep 28, 2009
Messages
396
I am using a modeless userform which I want to postion at top-left corner of worksheet(above cell A1) when the form is activated.

I was using below code:
Code:
Private Sub UserForm_Activate()
 '// Form position with respect to application window
    With frmMenubar
        .Top = Application.Top + 170 '< change 125 to what u want
        .Left = Application.Left + 35 '< change 25 to what u want
    End With
End Sub

How do I change the code to put the form on top-left of worksheet?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I tried to follow that.
I put following code.

Code:
Private Sub UserForm_Activate()
    Dim PS As Positions
    frmMenubar.StartupPosition = 0
    PS = PositionForm(frmMenubar, Range("A1"), 0, 0, cstFvpAuto, cstFhpAuto)
    frmMenubar.Top = PS.FrmTop   ' set the Top position of the form
    frmMenubar.Left = PS.FrmLeft ' set the Left position of the form
        
End Sub

I wanted to position it starting from A1. No effect.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top