Dela via


ListObject.Range Property (2007 System)

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

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 Range As Range
'Usage
Dim instance As ListObject 
Dim value As Range 

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

Property Value

Type: 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 Class

ListObject Members

Microsoft.Office.Tools.Excel Namespace