I do some experiment about this screen updating and i found that there have some funny result, my code as below(not my code but modify from someone else)
Sub testing()
Dim elapsedTime(2)
Application.ScreenUpdating = True
For i = 1 To 2
If i = 2 Then Application.ScreenUpdating = False
startTime = Time
Worksheets("Sheet4").Activate
For test = 1 To 10000
Cells(test, 1).Value = "ndoqnwdonqowdnoqwdnoqwdnoqwn"
Next
stopTime = Time
elapsedTime(i) = (stopTime - startTime) * 24 * 60 * 60
Next i
Application.ScreenUpdating = True
MsgBox "Elapsed time, screen updating on: " & elapsedTime(1) & _
" sec." & Chr(13) & _
"Elapsed time, screen updating off: " & elapsedTime(2) & _
" sec."
End Sub
maybe 1st time the updating = false is faster that true, but when I test several times with different maximum for loop, the result is true faster that false, may someone let me know what problem?
NOTE: the loop maximum I did try extremely large number, such as 1000000
Sub testing()
Dim elapsedTime(2)
Application.ScreenUpdating = True
For i = 1 To 2
If i = 2 Then Application.ScreenUpdating = False
startTime = Time
Worksheets("Sheet4").Activate
For test = 1 To 10000
Cells(test, 1).Value = "ndoqnwdonqowdnoqwdnoqwdnoqwn"
Next
stopTime = Time
elapsedTime(i) = (stopTime - startTime) * 24 * 60 * 60
Next i
Application.ScreenUpdating = True
MsgBox "Elapsed time, screen updating on: " & elapsedTime(1) & _
" sec." & Chr(13) & _
"Elapsed time, screen updating off: " & elapsedTime(2) & _
" sec."
End Sub
maybe 1st time the updating = false is faster that true, but when I test several times with different maximum for loop, the result is true faster that false, may someone let me know what problem?
NOTE: the loop maximum I did try extremely large number, such as 1000000
Last edited: