Share via


ListObject.Range Property

Gets a Range that represents the range to which the ListObject applies.

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

Syntax

'Declaration
ReadOnly Property Range As Range
Range Range { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Range
A Range that represents the range to which the ListObject applies.

Remarks

Includes the header, Insert row and Totals row if displayed.

Examples

The following code example creates a ListObject and then displays a message showing how many cells are in the range to which the ListObject applies.

This example is for a document-level customization.

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

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

    MessageBox.Show("The list object contains " +
        list1.Range.Cells.Count.ToString() + " cells.");
}

.NET Framework Security

See Also

Reference

ListObject Interface

Microsoft.Office.Tools.Excel Namespace