Compartir a través de


NamedRange.Next Property

Definition

Gets a Range that represents the next cell.

public:
 property Microsoft::Office::Interop::Excel::Range ^ Next { Microsoft::Office::Interop::Excel::Range ^ get(); };
public Microsoft.Office.Interop.Excel.Range Next { get; }
member this.Next : Microsoft.Office.Interop.Excel.Range
Public ReadOnly Property Next As Range

Property Value

A Range that represents the next cell.

Examples

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();
}
Private nextCellRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub SelectNext()
    nextCellRange = Me.Controls.AddNamedRange( _
        Me.Range("C1"), "nextCellRange")

    Me.nextCellRange.Next.Select()
End Sub

Remarks

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.

Applies to