Name
listrow
.Delete
Synopsis
Removes a row from a list, deleting the data it contains and shifting rows up. The Add
method acts on the ListRows
collection, whereas the Delete
method acts on the ListRow
object.
Use the ListObjects
Item
method to get the row to delete. For example, the following code deletes the second row of a list (undoing the code shown for the previous Add
method):
Sub DeleteRow( ) Dim ws As Worksheet, lst As ListObject Set ws = ActiveSheet Set lst = ws.ListObjects("Test List") lst.ListRows(2).Delete End Sub
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.