I wrote the following code from here and there:
Workbooks(location1).Worksheets("Lab Bench").ListObjects("ItemsSummary").Range("ItemsSummary[#All]").Select 'ItemsSummary is the name of the table, it has 18 columns
lRow = Workbooks(location2).Worksheets(Sheet1).ListObjects("ItemsSummary").ListRows.Count
LO.ListRows(lRow).Range.Select 'Select last row in a table
BottomOfTable = ActiveCell.Row 'Row number of the worksheet
'Inserts a new table 1 row below the desired table
ws.ListObjects.Add(xlSrcRange, Range("C" & BottomOfTable + 1, "H" & BottomOfTable + 1), , xlNo).Name = "ItemsSummary"
This code throws in this error: Subscript out of range (Error 9)
I am new to coding and i would appreciate any help with this. Please suggest any better way to do this. I have scratched half my scalp with this