If we set Screen Updating property to TRUE then it turns on the screen updating else turn off the screen updating. In the above syntax Application represents object and Screen Updating is the Property of Application object.
When we set Screen Updating property of an application object to false then it will speed up the macro. Please find the below example for Screen Updating Property of an application object in excel VBA.
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.
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.
Range For repeat = 1 To 30 For Each cell In r cell. Value Mod 2 = 0) Then ' if i is even, color the cell white cell.
Color = vb White End If i = i 1 Next cell ' offset i to alternate column coloring i = i 1 Next repeat Msg Box "Total time was: " & (Timer - start Time) Application.
Don’t forget to reset the Screen Updating valsue as TRUE at the end of the macro.
Please follow the below steps to execute the VBA code to save the excel file. Step 2: Press Alt F11 – This will open the VBA Editor.