NamedRange.Next Property

 

Gets a Microsoft.Office.Interop.Excel.Range that represents the next cell.

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

Range Next { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Range

A Microsoft.Office.Interop.Excel.Range that represents the next cell.

This property emulates the TAB key, although the property returns the next cell without selecting it.

On a protected sheet, this property returns the next unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the right of the specified cell.

The following code example creates a NamedRange and then uses the Next property to select the cell to the right of the NamedRange.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange nextCellRange;
private void SelectNext()
{
     nextCellRange = this.Controls.AddNamedRange(
         this.Range["C1"], "nextCellRange");

    this.nextCellRange.Next.Select();
}
Return to top
Show: