ListRows Property

Microsoft Excel Visual Basic

ListRows Property

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

expression.ListRows

expression    Required. An expression that returns 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.

    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