View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default sum two named ranges, cell-by-cell

George,

Try some code like the following:

Dim Ndx As Long
Dim Result As Double
For Ndx = 1 To Range("X").Rows.Count
Result = Range("X")(Ndx) + Range("Y")(Ndx) + Range("Z")(Ndx)
Debug.Print Result
Next Ndx


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"George" wrote in
message ...
If I have x = A1:A4, y= B1:B4, z = C1:C4. Is there a way in a
VBA script to do
z[i] = x[i] + y[i]?

Thanks,
George