ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro: Copy data to another sheet (https://www.excelbanter.com/excel-discussion-misc-queries/245811-macro-copy-data-another-sheet.html)

Anders[_2_]

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

Per Jessen

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



Don Guillett

Macro: Copy data to another sheet
 
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Anders" wrote in message
...
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



Anders[_2_]

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