Userform startup position

rickblunt

Active Member
Joined
Feb 18, 2008
Messages
457
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
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
7,918
Office Version
2007
Platform
Windows
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
 

rickblunt

Active Member
Joined
Feb 18, 2008
Messages
457
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
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
7,918
Office Version
2007
Platform
Windows
I'm glad to help you. Thanks for the feedback.
 

Forum statistics

Threads
1,078,435
Messages
5,340,260
Members
399,361
Latest member
Linford

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top