• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Why does application.screenupdating = False is not working

ThrottleWorks

Excel Ninja
Hi,

This is a problem I face every day.
I have a macro with multiple modules, for example 10 modules. I am calling all the 9 modules from first module.

At every module, at start I have screen updating to false and at the end, set to true.
Still, when I run macro, I can see screen updating in progress.

How can I avoid this, can anyone please help me this.
 
Hi Sachin ,

Why not turn Screen Updating OFF in the main module , and turn it ON again also in the main module , after all the 9 sub-modules have been called ?

Narayan
 
If you have routines that may run on their own or be called from somewhere else, you can store the initial value of ScreenUpdating and then reset it:

Code:
Sub foo()
Dim bUpdate as Boolean
bUpdate = Application.Screenupdating
Application.Screenupdating = False

' rest of the code here

Application.Screenupdating = bUpdate
End Sub

That way, when you call it from another sub that had already turned screen updating off, it won't turn it back on when it ends - it leaves that up to the calling routine. You can also simply leave out the line that sets it back to True, or use a class module.
 
Back
Top