Macro: Copy data to another sheet
Hi,
I have a rather simple question, I think. I have a matrix of numbers (M38:O49) on sheet1. I need to have a macro that copies these numbers from sheet1 to sheet2. On sheet2 the numbers should not just be copied into a new matrix (AB3:AD12), but added to the numbers already located in the sheet2 matrix. So if my matrix on sheet1 consists of only 1's and the matrix on sheet2 consists of 4's, then the matrix on sheet2 should read only 5's after applying the macro. Now filling sheet1 with only 4's should then produce a matrix on sheet2 with only 9's after applying the macro once more, etc. How can I do this (is has to be a macro!)? Anders |
Macro: Copy data to another sheet
Hi Anders
M38:O49 = 12 rows AB3:AD12=10 rows only This will paste the original range into AB3:AD14 Sub AddMatrix() Sheets("Sheet1").Range("M38:O49").Copy Sheets("Sheet2").Range("AB3").PasteSpecial Operation:=xlAdd End Sub Regards, Per "Anders" skrev i meddelelsen ... Hi, I have a rather simple question, I think. I have a matrix of numbers (M38:O49) on sheet1. I need to have a macro that copies these numbers from sheet1 to sheet2. On sheet2 the numbers should not just be copied into a new matrix (AB3:AD12), but added to the numbers already located in the sheet2 matrix. So if my matrix on sheet1 consists of only 1's and the matrix on sheet2 consists of 4's, then the matrix on sheet2 should read only 5's after applying the macro. Now filling sheet1 with only 4's should then produce a matrix on sheet2 with only 9's after applying the macro once more, etc. How can I do this (is has to be a macro!)? Anders |
Macro: Copy data to another sheet
Per Jessen skrev:
Hi Anders M38:O49 = 12 rows AB3:AD12=10 rows only Sorry, my mistake. Wrote the wrong numbers :-) Sub AddMatrix() Sheets("Sheet1").Range("M38:O49").Copy Sheets("Sheet2").Range("AB3").PasteSpecial Operation:=xlAdd End Sub Works like a charm! Thank you. Anders |
All times are GMT +1. The time now is 04:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com