ListObject.Range Property

Definition

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

public Microsoft.Office.Interop.Excel.Range Range { get; }

Property Value

A Range that represents the range to which the ListObject applies.

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 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.");
}
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

Remarks

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

Applies to