Userform startup position

rickblunt

Well-known Member
Joined
Feb 18, 2008
Messages
609
Office Version
  1. 2019
Platform
  1. Windows
Greetings, I am using the following code to open a number of userforms simultaneously in a cascade layout. The first code (cleanroom zone) runs perfectly and the userforms layout just as I want them to. But the second one (grayroom zone) doesn't. The userforms do not start up in the same place, in fact a couple of them are stacked directly on each other. I can't figure out why, the code is exactly the same on each one. Anyone have an idea why they are not launching the same? Thanks,


Code:
Private Sub CleanroomZoneButton_Click()

    Unload EmergencyLightArea

    With DataEntryEmergencyShowerCr
    .Top = 10
    .Left = 10
    End With
    DataEntryEmergencyShowerCr.Show
        
    With DataEntryFeCr
    .Top = 50
    .Left = 50
    End With
    DataEntryFeCr.Show
        
    With DataEntryElCr
    .Top = 100
    .Left = 100
    End With
    DataEntryElCr.Show
        
    With DataEntryLadder
    .Top = 150
    .Left = 150
    End With
    DataEntryLadder.Show
        
    
End Sub
Code:
Private Sub GrayroomZoneButton_Click()

    Unload EmergencyLightArea
    
    With DataEntryEmergencyShowerGr
    .Top = 10
    .Left = 10
    End With
    DataEntryEmergencyShowerGr.Show
        
    With DataEntryFeGr
    .Top = 50
    .Left = 50
    End With
    DataEntryFeGr.Show
        
    With DataEntryElGr
    .Top = 100
    .Left = 100
    End With
    DataEntryElGr.Show
        
    With DataEntryLadder
    .Top = 150
    .Left = 150
    End With
    DataEntryLadder.Show
    

End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try this

Code:
Private Sub CleanroomZoneButton_Click()


    Unload EmergencyLightArea


    DataEntryEmergencyShowerCr.Show
    With DataEntryEmergencyShowerCr
    .Top = 10
    .Left = 10
    End With
[COLOR=#0000ff]    DoEvents[/COLOR]
        
    DataEntryFeCr.Show
    With DataEntryFeCr
    .Top = 50
    .Left = 50
    End With
    DoEvents
        
    DataEntryElCr.Show
    With DataEntryElCr
    .Top = 100
    .Left = 100
    End With
    DoEvents


    DataEntryLadder.Show
    With DataEntryLadder
    .Top = 150
    .Left = 150
    End With
    DoEvents
End Sub


Private Sub GrayroomZoneButton_Click()


    Unload EmergencyLightArea
    
    DataEntryEmergencyShowerGr.Show
    With DataEntryEmergencyShowerGr
    .Top = 10
    .Left = 10
    End With
[COLOR=#0000ff]    DoEvents[/COLOR]
        
    DataEntryFeGr.Show
    With DataEntryFeGr
    .Top = 50
    .Left = 50
    End With
    DoEvents
    
    DataEntryElGr.Show
    With DataEntryElGr
    .Top = 100
    .Left = 100
    End With
    DoEvents
        
    DataEntryLadder.Show
    With DataEntryLadder
    .Top = 150
    .Left = 150
    End With
    DoEvents
End Sub
 
Upvote 0
Thanks for the reply Dante, I realized later that I had made a rookie mistake and that the startup settings on some of my userforms was set to "1-center" instead of "0-manual". Duh, I appreciate the help
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,245
Members
448,555
Latest member
RobertJones1986

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