Form Hiding & Screen Updating

Carly

Active Member
Joined
Aug 21, 2002
Messages
370
I have got a form with the following code attached to a button:
Code:
Private Sub btn_Stage1_Click()
    If txtMonth.Value = "" Then
        MsgBox ("You need to enter a month MMMYY")
        txtMonth.SetFocus
    Else
    vMonth = txtMonth.Value
        frmStages.Hide
        Call Stage1
    End If
End Sub

which then calls this code:

Code:
Sub Stage1()
    Application.ScreenUpdating = False
    .....etc

When I debug through this code, it works, hides the form & works through the rest of the code but then I run it properly, the form is always in view.

Is there anything I am doing wrong?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Thanks for the reply.
This does exactly the same thing though, plus unloads all the data which I need later on when I reload the form.
 
Upvote 0
OK what about dealing with the screen updating prior to hiding the form

Application.ScreenUpdating = False
UserForm1.Hide
Application.ScreenUpdating = True
 
Upvote 0
Have you by any chance disabled screenupdating before you showed the form in the first place?
 
Upvote 0
Thank you for your replies as always:

I have now changed it to the following and it works perfectly:
Code:
Private Sub btn_Stage1_Click()
    If txtMonth.Value = "" Then
        MsgBox ("You need to enter a month MMMYY")
        txtMonth.SetFocus
    Else
    vMonth = txtMonth.Value
        Application.ScreenUpdating = False
        frmStages.Hide
        Application.ScreenUpdating = True
        Call Stage1
    End If
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

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