Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Screen Updating Problem
Sub MacroA_AllSheets()
Dim ws As Worksheet Application.ScreenUpdating = False For Each ws In Worksheets ws.Activate Call MacroA Next ws Application.ScreenUpdating = True End Sub How to handle ScreenUpdating in MacroA depends on how else it may be called in your project, lets say you have the above and somewhere else simply this Sub MacrA_ActiveSheet 'best to disable screenupdating here ' but for some reason don't want to Call MacroA End Sub Sub MacroA() Dim bScrUpdating As Boolean bScrUpdating = Application.ScreenUpdating Application.ScreenUpdating = False Code If bScrUpdating then Application.ScreenUpdating = True End If End Sub Regards, Peter T "Shatin" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem with Splash Screen user form with updating status | Excel Programming | |||
Screen Updating problem with nested subroutines | Excel Programming | |||
Screen Updating | Excel Programming | |||
Screen updating | Charts and Charting in Excel | |||
Screen Updating | Excel Programming |