ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Block addition of ranges (https://www.excelbanter.com/excel-programming/389945-block-addition-ranges.html)

[email protected]

Block addition of ranges
 
I am trying to achieve the following with a vba macro:

Add the values of Rng1 on top of the existing values in Rng2. Rng1 &
Rng2 are the same dimensions. It can be done by copying Rng1 and doing
a PasteSpecial values add command to Rng2. However, it is a
requirement that this macro does not use the clip board.

Would really appreciate any ideas.


Tom Ogilvy

Block addition of ranges
 
for i = 1 to rng1.count

rng2(i) = rng2(i) + rng1(i)
Next

--
Regards,
Tom Ogilvy


" wrote:

I am trying to achieve the following with a vba macro:

Add the values of Rng1 on top of the existing values in Rng2. Rng1 &
Rng2 are the same dimensions. It can be done by copying Rng1 and doing
a PasteSpecial values add command to Rng2. However, it is a
requirement that this macro does not use the clip board.

Would really appreciate any ideas.



Jim Jackson

Block addition of ranges
 
One idea.

Sub TEST()
Range("D3") = Range("A50").Value
'repeat for each cell involved
'or set up a loop to cover the cells
End Sub
--
Best wishes,

Jim


" wrote:

I am trying to achieve the following with a vba macro:

Add the values of Rng1 on top of the existing values in Rng2. Rng1 &
Rng2 are the same dimensions. It can be done by copying Rng1 and doing
a PasteSpecial values add command to Rng2. However, it is a
requirement that this macro does not use the clip board.

Would really appreciate any ideas.




All times are GMT +1. The time now is 05:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com