Enableevents screenupdating dating bride com

The example hides every other column on Sheet1, while keeping track of the time it takes to do so.

The first time the example hides the columns, screen updating is turned on; the second time, screen updating is turned off. Hidden = True End If Next c stop Time = Time elapsed Time(i) = (stop Time - start Time) * 24 * 60 * 60 Next i Application.

Used Range) = 0 Then J = 0 End If Set x Rg = Worksheets("Sheet1").

Calculation = xl Calculation Automatic End Sub Sub Loop Example() Dim Cell As Range Call YK_Start Columns("B: F").

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?

Remarks Turn screen updating off to speed up your macro code.

You won't be able to see what the macro is doing, but it will run faster.

Remember to set the Screen Updating property back to True when your macro ends.

Example This example demonstrates how turning off screen updating can make your code run faster.

When you run this example, you can compare the respective running times, which are displayed in the message box. Screen Updating = True For i = 1 To 2 If i = 2 Then Application.

Screen Updating = False start Time = Time Worksheets("Sheet1").

So if your code is not updating too many sheets/cells but your workbook has many formulas then turning off the screen update might not help you at all.

Tags: , ,