User Form Position

cfoye130

Board Regular
Joined
Aug 12, 2008
Messages
84
I have two userforms. On a command button click of 1 form, that form shows the next form, and then unloads itself. Is there a way to capture the screen location of the 1st userform on the click, and then use it in the initialize code of the other form to place the 2nd form in the same position as the first used to be?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Yes - something like:
Code:
   Dim frm               As UserForm2
   Set frm = New UserForm2
   Me.Hide
   With frm
      .StartUpPosition = 0
      .Top = Me.Top
      .Left = Me.Left
      '.height = me.height
      '.width = me.width
   End With
   frm.Show
   Set frm = Nothing
   Unload Me
 
Upvote 0
Code:
Private Sub CommandButton1_Click()
    With New UserForm2
        .StartUpPosition = 0
        .Left = Me.Left
        .Top = Me.Top
        Unload Me
        .Show
    End With
End Sub

EDIT: oops, too late despite less code :-)
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

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