Kiwi
Kiwi

Reputation: 143

Excel 2007 - Macro copy and paste between work sheets, onto a new line

I am using Excel 2007, I am trying to create a macro between 2 different worksheets.

I am trying to copy cells and paste them into worksheet 2. This I realise is quite simple but here is my problem - I want that every time the macro is run, that it can copy the value onto a new row in worksheet 2.

For example:
Example of data: Row headings : (a1) Month, (b1) 1, (c1) 2, (d2) 3. Data :(a1) July-12, (b2) 2, (c2) 5, (d2) 1 Data : (a1) Aug-12, (b2) 1, (c2) 4, (d2) 2.

Location of where to be copied. Row headings : (a1) Month, (b1) values of 1, (c1) values of 2, (d2) values of 3.

I have never used VB before, I am used to just using the forumlaes on Excel.
I have tried the following: Range("A1:A2").Select Selection.Copy Range("C4").Select ActiveSheet.Paste

I am trying to automate my spreadsheet, rather than having to note a figure from one work sheet, then write it in another worksheet.

I am unsure if I am over complicating things in my own mind, or if this is more complex..

Many thanks in advance to all responses.

Upvotes: 2

Views: 2734

Answers (1)

android_newbie
android_newbie

Reputation: 106

I might be very late with this but here you can find the last row of Sheet2 by

Lrow=ThisWorkbook.Sheets("Sheet2").Cells(65536,).end(Xlup).Row

Once you have found the last row you can paste the range in the next row after thelast row by incrementing it by 1 as shown below.

Range("A1:A2").Select 
Selection.Copy Range("C" & Lrow+1).Select ActiveSheet.Paste

Hope this helps!

Upvotes: 0

Related Questions