ListObject.ListRows Property

Excel Developer Reference

Returns a ListRows object that represents all the rows of data in the ListObject object. Read-only.

Syntax

expression.ListRows

expression   A variable that represents a ListObject object.

Remarks

The ListRows object returned does not include the header, total, or Insert rows.

Example

The following example deletes a row specified by number in the ListRows collection that is created by a call to the ListRows property.

Visual Basic for Applications
  Sub DeleteListRow(iRowNumber As Integer)
    Dim wrksht As Worksheet
    Dim objListObj As ListObject
    Dim objListRows As ListRows
   
    Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
    Set objListObj = wrksht.ListObjects(1)
    Set objListRows = objListObj.ListRows
If (iRowNumber <> 0) And (iRowNumber < objListRows.Count - 1) Then
    objListRows(iRowNumber).Delete
End If

End Sub

See Also