View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default most efficient large range summing?

Another:

Const RowCount As Long = 50000

Sub Alt2()
Dim Arr1 As Variant
Dim Arr2 As Variant
Dim Counter As Long
Arr1 = Range("A1").Resize(RowCount).Value
Arr2 = Range("B1").Resize(RowCount).Value
For Counter = 1 To RowCount
Arr1(Counter, 1) = Arr1(Counter, 1) + Arr2(Counter, 1)
Next
Range("C1").Resize(RowCount).Value = Arr1
End Sub


--
Jim
"jonigr" wrote in message
...
| This simple routine has crept into my code and I use it thoughtlessly and
| often:
|
| For i = 1 To 50000 ' some seriously large value here!
| Range("C" & i).Value = Range("A" & i).Value + Range("B" & i).Value
| Next i
|
| I discovered it is a time-consumer, searched for alternatives and found
| several, but am just not VBA fluent enough to judge their efficiency.
|
| Any more experienced programmers can help me find the truly fastest
solution?
|
| Thanks!
|
| -Joni