Hello:
The code below adds data from a range in sheet 1 to a table in sheet 2. How could I edit the following line so that the table will resize by the number of new entries that are pasted.
ActiveSheet.ListObjects("Table1").Resize Range("$A$1:$B$10")
Sub CopyPaste()
Dim i As Long 'i is the last row in column B of sheet2
Dim j As Long 'j is the last row + 1 in column A of sheet1
i = Sheets("sheet1").Cells(Rows.Count, 2).End(xlUp).Row
j = Sheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheets("sheet1").Range("A2:J" & i).Copy Sheets("sheet2").Range("A" & j)
Sheets("Sheet2").Select
ActiveSheet.ListObjects("Table1").Resize Range("$A$1:$B$10")
End Sub
Bookmarks