Sub to append data below existing

M

Max

I've got source data in sheet: x,
in cols A to I, data from row2 down

In another sheet: y (received daily, for new data)
Data is in cols A to I (identical to x's structure), from row2 down
Col A in y can be used to determine the last data row

I'd like to run a sub to update x with the new data in y. The new data is to
simply append to x's cols A to I, below existing data, determined by last
data row in x's col A
 
M

Mike H

Hi,

Right click one of your sheet tabs, view code and paste this in and run it.

Sub mariner()
lastrow = Sheets("Y").Cells(Cells.Rows.Count, "A").End(xlUp).Row
Sheets("Y").Range("A2:I" & lastrow).Copy
lastrow = Sheets("X").Cells(Cells.Rows.Count, "A").End(xlUp).Row
Sheets("X").Range("A" & lastrow + 1).PasteSpecial
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top