VBA Tip: Lower the Execution Time of a Macro
If you are using a macro that calls for a lots of modifications to your worksheet, Excel will update its display each time the worksheet is modified, which can cause the macro to run considerably slower ...
To tell Excel not to update the display, add this to your code:
Sub example() Application.ScreenUpdating = False 'The rest of your code here ... Application.ScreenUpdating = True 'Optional End Sub
Example showing how much time can be saved
The following test was carried out by the macro that generates the annual calendar for the Calendar-Pratique application.
Without ScreenUpdating, the execution time was 27.98 seconds:
With ScreenUpdating, the execution was reduced to only 0.59 seconds:
If your macro runs a bit slow, you should think about using this trick !