Skip to main content

ListObject.ListRows property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

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.

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

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>