Screenupdating false word
You may even find in some cases that Screen Updating is set back to true before your recorded macro completes.
This can happen with recorded macros that have the word Select used frequently.
Free Excel Help One drawback with recorded macros in Excel is that the code produced is often very inefficient.
It also means that we cannot tell the macro recorder to not record our steps of selecting cells, sheets and scrolling around, even though the selecting of cells, sheets and scrolling is not needed in true VBA code.
It does just what it sounds like, while screen updating is turned off the screen will not show any changes that Excel executes and no new data will be displayed until screen updating is set back to true or the program ends.
Excel wastes a lot of time showing you the changes it is making and honestly there is no reason to watch your code execute, I remember running some report generation code that took a good ten times longer than it would if only the programmer had included Application. So always turn off screenupdating, your users will thank you.
This can mean that what should take a matter of 1 to 3 seconds, often takes a lot longer.The reason it speeds up code is because Excel no longer needs to repaint the screen whenever it encounters such commands as Select, Activate, Large Scroll, Small Scroll and many others. Screen Updating=False should be placed at the Start of your macro like shown below Note how we have set the Screen Updating back to True on completion.While Excel will set this back to True whenever focus is passed back to Excel (your macro finishes) in most cases, it pays to play it safe and include the code at the end.Declare Function Find Window Lib "user32" Alias "Find Window A" (By Val lp Class Name As String, By Val lp Window Name As Long) As Long ' Use Lock Window Update to prevent/enable window refresh Declare Function Lock Window Update Lib "user32" (By Val hwnd Lock As Long) As Long ' Use Update Window to force a refresh of the Power Point window Declare Function Update Window Lib "user32" (By Val hwnd As Long) As Long Property Let Screen Updating(State As Boolean) Static hwnd As Long Dim Version No As String ' Get Version Number If State = False Then Version No = Left(Application. Version, ".") - 1) 'Get handle to the main application window using Class Name Select Case Version No Case "8" ' For PPT97: hwnd = Find Window("PP97Frame Class", 0&) Case "9" ' For PPT2K: hwnd = Find Window("PP9Frame Class", 0&) Case "10" ' For XP: hwnd = Find Window("PP10Frame Class", 0&) Case "11" ' For 2003: hwnd = Find Window("PP11Frame Class", 0&) Case "12" ' For 2007: hwnd = Find Window("PP12Frame Class", 0&) Case "14" ' For 2010: hwnd = Find Window("PPTFrame Class", 0&) Case Else Err.Raise Number:=vb Object Error ERR_VERSION_NOT_SUPPORTED, _ Description:="Newer version." Exit Property End Select If hwnd = 0 Then Err.