Application.ScreenUpdating

If your macros take a long time to run the screen will often flicker very quickly as it constantly updates with the latest changes.
It is possible to remove the flickering by changing the ScreenUpdating property to False
Your code will also run slightly faster when the screen updating property is set to False.
Switching the screenupdating off can dramatically increase the time taken to run a macro
This property will be automatically reset to True after your macro has run but it is good practice to change this explicitly in your code.


Excel

The ScreenUpdating property will not be automatically reset to True at the end of your macro so you must always change the screenupdating back explicitly.
In Excel 97 and 2000 it was not necessary to manually reset the screenupdating back to True as this was done for you automatically at the end of a macro.

Application.ScreenUpdating = False 
'add your code here
Application.ScreenUpdating = True

Word

Application.ScreenUpdating = False 
'add your code here
Application.ScreenUpdating = True

PowerPoint

The property Application.ScreenUpdating does not exist in PowerPoint.


Important

This is always set to True when you are debugging.
You should always make sure that the screenupdating is on when you display a userform, otherwise moving the userform will erase whatever is behind it.
It is very important that you set the screenupdating back to its original value once your code has run, even if an error or exception occurs.
The status bar continues to be updated even when screenupdating is switched off.


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext