How do I paste data into the 'next row down'?


Posted by Richard on December 28, 2001 5:50 AM

I'm trying to create a simple macro where I can paste a single row of data from one spreadsheet (A) to a row in another spreadsheet (B).

I want to preserve existing data in B, so I need to instruct the macro to paste the data into 'the next row down' in spreadsheet B - how do I instruct the macro to do this?

Posted by Scott on December 28, 2001 6:16 AM

Here try this:

Sub CopyToNext()

Range("A1:F1").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
End Sub




Posted by Tom Urtis on December 28, 2001 6:18 AM

Try this code, it accommodates you always adding data to your copy from sheet, so that it will always copy the last row from Sheet1, and paste into the next available row of Sheet2.

Sub PasteIt()
Sheets("Sheet1").Range("A65536").End(xlUp).EntireRow.Copy _
Destination:=Sheets("Sheet2").Range("A65536").End(xlUp).Offset(1, 0)
End Sub


Any help?

Tom Urtis