I have a workbook that produces a single row of data for each month. I want to append that data into a running list of previous months in a different workbook.
The code copies the data from the worksheet then pastes the data into the other worksheet.
My problem is it will just paste in the first row. I want to paste at the bottom of any data that's already there.
Private Sub CommandButton1_Click()
Dim wbSource As Workbook
Dim wbTarget As Workbook
Dim shSource As Worksheet
Dim shTarget As Worksheet
Dim LastRow As Long
Set wbSource = ThisWorkbook
Set wbTarget = Workbooks.Open(Filename:="Y:\DEVTEST.xlsx")
Set shSource = wbSource.Worksheets("Append")
shSource.Range("A2:U2").Copy
' Reference to sheet to copy to
Set shTarget = wbTarget.Worksheets("Sheet1")
LastRow = WorksheetFunction.Max(Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row)
shTarget.Cells(LastRow, "A").PasteSpecial xlPasteValues
End Sub