levanduyet
05-13-2010, 07:26 PM
Dear All,
We are testing to compare between Evaluate & For Loop which method is faster as following:
1) Test Evaluate:
Sub Test1()
Dim TG As Double
TG = Timer
[A:A] = [ROW(R:R)]
[E1] = Format(Timer - TG, "0.000000000")
End Sub
2) Test For Loop:
Sub Test2()
Dim i As Long, Arr() As Long, TG As Double
TG = Timer
ReDim Arr(1 To Cells.Rows.Count, 1 To 1)
For i = 1 To Cells.Rows.Count
Arr(i, 1) = i
Next
Range("C:C").Value = Arr
[G1] = Format(Timer - TG, "0.000000000")
End Sub
It look like Evaluate method is slower For loop.
Anyone has any comments.
Tks,
LVD
We are testing to compare between Evaluate & For Loop which method is faster as following:
1) Test Evaluate:
Sub Test1()
Dim TG As Double
TG = Timer
[A:A] = [ROW(R:R)]
[E1] = Format(Timer - TG, "0.000000000")
End Sub
2) Test For Loop:
Sub Test2()
Dim i As Long, Arr() As Long, TG As Double
TG = Timer
ReDim Arr(1 To Cells.Rows.Count, 1 To 1)
For i = 1 To Cells.Rows.Count
Arr(i, 1) = i
Next
Range("C:C").Value = Arr
[G1] = Format(Timer - TG, "0.000000000")
End Sub
It look like Evaluate method is slower For loop.
Anyone has any comments.
Tks,
LVD