- Jul 24, 2018
- Office Version
Hello. I am using a Macro to create a worksheet that contains a table. The name of the table is PayData, however since this table is on every worksheet (individual employees) Excel gives it a name such as PayData28. How can I use the below VBA code to identify the PayData table that is on the worksheet properly?
Sub AddRow() Dim ws As Worksheet Set ws = ActiveSheet Dim tbl As ListObject Set tbl = ws.ListObjects("A9") 'add a row at the end of the table tbl.ListRows.Add 'add a row as the fifth row of the table (counts the headers as a row) End Sub