In MS Excel, has anyone ever written anything that when in a cell and pressing enter instead of moving to the next cell the focus stays in the original cell. I think that makes sense.
you can go to Tools>Options>Edit and uncheck the box that says Move selection after Enter, or you can choose which way you want to go when you press enter.
That works but it turns it off for the whole application. I would like to apply that function to just one cell or sheet or workbook. Whichever level is possible.
If you want it to only apply to one cell use this. It is a bit slow so I wouldn't use it. It is up to you.
Place this in VBA in the Sheet with the cell you want it to apply to.
The Cell this applies to is A2 as you can see. Just change this address for your cell.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$A$2" Then
Application.MoveAfterReturn = False
Else
Application.MoveAfterReturn = True
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.