Name
listrows
.Add([Position
])
Synopsis
Inserts a new, blank row into the list, shifting subsequent rows down. The Position
argument indicates where to insert the row. For example, the following code creates a new, blank row at the second row in the list:
Sub InsertRow( ) Dim ws As Worksheet, lst As ListObject Set ws = ActiveSheet Set lst = ws.ListObjects("Test List") lst.ListRows.Add (2) End Sub
If Position
is omitted, the new row is inserted at the end of the list.
Each row in a shared list has a unique ID assigned to it. When you create a new shared list, row IDs are created sequentially from top to bottom. As you add and delete rows within a list, new row IDs are created and existing IDs are deleted, so the sequential order of IDs is not preserved.
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.