"Run-time error '1004': This operation is not allowed. The operation is attempting to shift cells in a table on your worksheet."
The reason for this error is that the table below has 3 columns and the top table has 2 columns.
If you add a row to a table using ListRows.Add means only 2 cells are inserted into the sheet in this case, which would destroy the table below.
The solution is to insert an entire row and resize the table.
Andreas.
Option Explicit
Sub Main()
AddTableRow ActiveSheet.ListObjects(1)
AddTableRow ActiveSheet.ListObjects(2)
End Sub
Sub AddTableRow(ByVal Table As ListObject)
Dim R As Range
'Get all cells in this table
Set R = Table.Range
'Get the bottom right cell
Set R = R.Resize(1, 1).Offset(R.Rows.Count - 1, R.Columns.Count - 1)
'Insert a row below
R.Offset(1).EntireRow.Insert
'Resize the table
Table.Resize Range(Table.Range, R.Offset(1))
End Sub