Share via


ListObject.ListRows Property (2007 System)

Gets a ListRows object that represents all the rows of data in the ListObject control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property ListRows As ListRows
'Usage
Dim instance As ListObject 
Dim value As ListRows 

value = instance.ListRows
[BrowsableAttribute(false)]
public ListRows ListRows { get; }
[BrowsableAttribute(false)]
public:
property ListRows^ ListRows {
    ListRows^ get ();
}
public function get ListRows () : ListRows

Property Value

Type: ListRows
A ListRows object that represents all the rows of data in the ListObject control.

Remarks

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

To delete any items from this collection, do not use the Delete method of the item. Use the Delete method of the range of the item to delete the item; for example ListRows.Item(1).Range.Delete().

Examples

The following code example creates a ListObject, gets the collection of rows, and then displays a message showing how many rows the ListObject contains.

This example is for a document-level customization.

Private Sub ListObject_ListRows()
    Dim List1 As Microsoft.Office.Tools.Excel.ListObject = _
        Me.Controls.AddListObject(Me.Range("A1", "C4"), "List1")

    Dim List1Rows As Excel.ListRows = List1.ListRows
    MessageBox.Show("The list object contains " & _
        List1Rows.Count.ToString() & " rows.")
End Sub
private void ListObject_ListRows()
{
    Microsoft.Office.Tools.Excel.ListObject list1 =
        this.Controls.AddListObject(
        this.Range["A1", "C4"], "list1");

    Excel.ListRows list1Rows = list1.ListRows;
    MessageBox.Show("The list object contains " +
        list1Rows.Count.ToString() + " rows.");
}

.NET Framework Security

See Also

Reference

ListObject Class

ListObject Members

Microsoft.Office.Tools.Excel Namespace