MoveAfterReturnDirection Property

Microsoft Office Web Components Visual Basic

Returns or sets the direction in which the focus is moved when the user presses the ENTER key and the MoveAfterReturn property is set to True. Read/write XlDirection .

expression.MoveAfterReturnDirection

expression    Required. An expression that returns a Spreadsheet object.

Example

This example causes the cell to the right of the active cell to be selected after the user presses the ENTER key.

Sub MoveAfterEnter()
    Dim ssConstants
    
    Set ssConstants = Spreadsheet1.Constants
    
    ' Enable the MoveAfterReturn property.
    Spreadsheet1.MoveAfterReturn = True
    
    ' Move the cursor one cell to the right when
    ' the user presses ENTER.
    Spreadsheet1.MoveAfterReturnDirection = xlToRight
End Sub