ListObject.InsertRowRange Property

Gets a Range that represents the Insert row, if any, of the ListObject control.

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

Syntax

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

Property Value

Type: Microsoft.Office.Interop.Excel.Range
A Range that represents the Insert row, if any, of the ListObject control.

Remarks

If there is no Insert row, InsertRowRange returns nulla null reference (Nothing in Visual Basic).

Examples

The following code example creates a ListObject, gets the range that contains the Insert row, and then displays a message showing how many cells the Insert row contains.

This example is for a document-level customization.

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

        Dim insertRow As Excel.Range = List1.InsertRowRange
        MessageBox.Show("The insert row contains " & _
            insertRow.Cells.Count.ToString() & " cells.")
    End Sub
private void ListObject_InsertRowRange()
{
    Microsoft.Office.Tools.Excel.ListObject list1 =
        this.Controls.AddListObject(
        this.Range["A1", "C4"], "list1");

    Excel.Range insertRow = list1.InsertRowRange;
    MessageBox.Show("The insert row contains " + 
        insertRow.Cells.Count.ToString() +
        " cells.");
}

.NET Framework Security

See Also

Reference

ListObject Interface

Microsoft.Office.Tools.Excel Namespace