Range Property

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)

Range Range { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Range

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

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

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.");
}
Return to top
Show:
© 2016 Microsoft