Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
1 Create a macro to Copy & paste certain data to another sheet | Excel Discussion (Misc queries) | |||
Macro to copy a sheet and name it | Excel Discussion (Misc queries) | |||
Macro to copy data from One sheet to another | Excel Discussion (Misc queries) | |||
Macro: Insert, copy and past data from sheet | Excel Discussion (Misc queries) | |||
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 | Excel Worksheet Functions |