Macro speed change when closing file
Just a guess...
I'd turn calculation to manual, then do the work, then change the calculation
back to whatever it was before.
In fact, there are a few things that can slow down macros. I do this kind of
thing to speed them up:
Option Explicit
Sub testme()
Dim CalcMode As Long
Dim ViewMode As Long
Application.ScreenUpdating = False
CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
ActiveSheet.DisplayPageBreaks = False
'do the work
'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode
End Sub
Your code will replace the "'do the work" line.
When/if you're hiding rows/columns, excel wants to figure out where to draw
those lines each time you change the layout.
snax500 wrote:
In Excel20000, how come sometimes a macro runs really slowly. I
sometimes have to Control-Break the macro if it is running really slow
(many minutes). I then close Excel and rerun the same macro and it
takes only seconds. Does anyone know why this might be happening?
Thanks
--
Dave Peterson
|