anra
anra

Reputation: 3

How to move over to the right cell in Excel after hitting enter without changing the "Options" settings

I'm trying to figure out how to move into the right cell after hitting enter without having to change it in the Options settings. Or if not, how to have each worksheet within a workbook go a different direction when I hit Enter. (i.e. Sheet 1: when you hit Enter, it goes to the right cell, Sheet 2: when you hit Enter it goes down).

Upvotes: 0

Views: 688

Answers (2)

JNevill
JNevill

Reputation: 50209

You could use VBA to change the Enter key's behavior when a sheet is activated (when you click a tab).

To do this go to your VBE (Ctrl+F11) and find your Workbook's code:

enter image description here

And double click "ThisWorkbook" to add code to the Workbook object.

In there you can use something like:

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    If Sh.Name = "Sheet1" Or Sh.Name = "Sheet3" Then
        Application.MoveAfterReturnDirection = xlToRight
    ElseIf Sh.Name = "Sheet2" Or Sh.Name = "sheet4" Then
        Application.MoveAfterReturnDirection = xlDown
    End If
End Sub

This will run anytime a sheet/tab is activated. It will flip the Enter key's behavior similar to you manually going into options and changing it yourself.

Upvotes: 3

Mikey
Mikey

Reputation: 153

Press TAB to move to the right

Upvotes: 3

Related Questions