View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Shatin[_2_] Shatin[_2_] is offline
external usenet poster
 
Posts: 56
Default Screen Updating Problem

I've been scratching my head how to solve this problem.

Say I have a MacroA which is something like this:

Sub MacroA()
Application.ScreenUpdating = False
Code
Application.ScreenUpdating = True
End Sub

There'll not be any screen flicker when MaroA is run. Everything is sweet.
Now there's a second macro which will run MacroA on all the worksheets:

Sub MacroA_AllSheets()
Dim ws As Worksheet
For Each ws In Worksheets
ws.Activate
Call MacroA
Next ws
End Sub

For this second macro, however I put in the Application.ScreenUpating
statements, the screen will still display the macro cycling through all the
worksheets. For example, the following does NOT solve the problem:

Sub MacroA_AllSheets()
Dim ws As Worksheet
For Each ws In Worksheets
Application.ScreenUpdating = False
ws.Activate
Call MacroA
Application.ScreenUpdating = False
Next ws
Application.ScreenUpdating = True
End Sub

The only way I can solve the problem is by deleting
Application.ScreenUpdating = True in MacroA, i.e.

Sub MacroA()
Application.ScreenUpdating = False
Code
End Sub

However I am not sure if this is what I want to do because I am not sure if
that means I'll be turning off ScreenUpating for good.

Any advice will be much appreciated.