The idea is to use the first line near the beginning of your macro, and then use the second line near the end.Thus, the main body of your macro can do its work behind the scenes without the necessity of stopping to update the screen.Updates the display on the monitor with the current information in the video memory buffer. Subsequent instructions don't update the screen until screen updating is turned on again with the Screen Updating property.
It is typically 5 to 10 times quicker (don’t catch me here it depends on what you really do) than VBA.Many people write their own macros to manipulate their documents.Many people write their own macros to manipulate the information in a workbook.Many times the macro may do quite a bit with the data, such as selecting different cells, replacing values or formulas, and taking other types of actions.Much better than staring at an unchanging screen for 40 seconds (that would be like watching the microwave for 40 seconds -- it takes forever).
Another program for others runs through about 25 steps. Status Bar text can be updated with anything throughout the macro - plain text, calculated completion precentages, elapsed time, etc.Screen Updating = False 'swap between sheets 1/2 (need both sheets or this will crash) For i = 1 To numb Switches Sheets(1 (i Mod 2)). Screen Updating = True 'get results for part two results = results & vb Cr Lf & "Screen Updating IS disabled: " & Format(Time - start Time, "hh:mm:ss") & " seconds" 'show results Msg Box results End Sub Firstly I've been using the script written by Richie (UK) Post #7 Here It simply iterates through a loop changing the value of i in one cell.I have changed it slightly so it loops 10,000 times and I execute it 10 times for sample size.The grater the amount of screen changes the bigger the impact will be. Other application settings that can make a difference to execution time are Calculation and Event handling. Enable Events = False ' Code here Clean Up: On Error Resume Next Application. Calculation = xl Calculation Automatic Application. Enable Events = True Exit Sub EH: ' Do error handling Go To Clean Up End Sub Sub test Screen Updating() Dim i As Integer Dim numb Switches As Integer Dim results As String 'swap between sheets this number of times numb Switches = 1000 'keep track of time Dim start Time As Double start Time = Time 'swap between sheets 1/2 (need both sheets or this will crash) For i = 1 To numb Switches Sheets(1 (i Mod 2)).Use this code template as a starting point (the error handler ensures that these properties are turned back on at the end of the sub, even if it errors) Sub Your Sub() On Error Go To EH Application. Select Next i 'get results results = "Screen Updating not disabled: " & Format(Time - start Time, "hh:mm:ss") & " seconds" start Time = Time 'scenario 2 - screenupdating disabled Application.For that, I post and update a userform for each step with a text message with the elapsed time, the number and name of each step, and a progress bar. Also, if the program quits, a screen snapshot tells me where the macros quit working on that user's computer. Don't use "Exit Sub", instead use "Go To End Of Macro" and place this code before "End Sub". Screen Updating = True The same goes for all you do with "Application.***" A simple and less involved method of providing progress updates would be to use the following line of code in the macro: Application. Prior to "End Sub", place this last line of code: Application. Screen Updating = False, the statusbar will change.] This does the side effect that it looks as though Excel has "hung" or crashed, especially if the macros is going to take some time to execute.