Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PasteSpecial with adding

Status
Not open for further replies.

stranger123

Programmer
Apr 16, 2006
76
GB
Hi,

In Excel VBA, I failure to paste whole usedrange from a sheet in another workbook onto the sheet in current workbook with adding operation.

......Copy
aRange.PasteSpecial Paste:=xlPasteValues, operation:=xlPasteSpecialOperationAdd

That was working if I copy from the same workbook.

Can you suggest the working code?

Thank you in advance.
 
What is the failure ?
Computer crash ? Error message ? Unexpected behaviour ? ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry, I forgot to say! I was able to paste the values from the whole usedrange of the outside workbook, but without adding the values onte the sells.
Say, I got cells(1,1)=1 in sheet1 in current workbook, and got cells(1,1)=2 in sheet1 in an outside workbook. I then copied the valu of 2 from outside and did pastespecial, after that, in current workbook cell(1,1)=2 (was only replaced). I want it become 1 + 2 = 3.
 
What happen if you do it manually ?
If it works as expected, what is the code generated by the macro recorder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thank you.
I can do it within the same workbook manually, but don't know how to do it for the outside workbook!
 
Hi,

I think I found that. We need to add the other workbook in the same excel application.......

Thank you again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top