Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
George,
I misread your post. Try the following code instead. Dim Ndx As Long For Ndx = 1 To Range("X").Rows.Count Range("Z")(Ndx) = Range("X")(Ndx) + Range("Y")(Ndx) Next Ndx -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Fri, 28 Apr 2006 16:21:14 -0500, "Chip Pearson" wrote:
George, I misread your post. Try the following code instead. Dim Ndx As Long For Ndx = 1 To Range("X").Rows.Count Range("Z")(Ndx) = Range("X")(Ndx) + Range("Y")(Ndx) Next Ndx That's nice - thank you. George |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
dynamically building references to named ranges | Excel Discussion (Misc queries) | |||
help with inserting a cell value into a named formula | Excel Discussion (Misc queries) | |||
Replace a spreadsheets named cells/ranges with exact cell address. | Excel Discussion (Misc queries) | |||
Possible Lookup Table | Excel Worksheet Functions | |||
Named Cell Ranges | Excel Discussion (Misc queries) |