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.
My understanding is that both properties can increase throughtput of the vba task though screenupdating property is to be used when the user should view the application but not the updation made until when required but visible property is to be used when the user does not require to see the window.
I beleive setting one property to false may not require setting the other to false.
So, here my question is - Which one(/both) of Application.screenupdating/Application.visible should I set as false?
Value 5 Next Cell Call YK_End End Sub using these procedures. EDIT #1 There are many ways to measure the execution time of your code; I don't know the most accurate one; I only need approximate value; See: How do you test running time of VBA code?
Visible = False For Each File In Dir Set obj Workbook = obj Excel.
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. 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.
Quick Jump Introduction | Example | Tutorial | Applications | Comments Prevent your screen from updating until your Excel macro is finished with Application. It can be used for other applications, but I find it most useful for Excel.