ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Change Enter key movement in one workbook only (https://www.excelbanter.com/excel-discussion-misc-queries/161289-change-enter-key-movement-one-workbook-only.html)

Mike K

Change Enter key movement in one workbook only
 
Oh Wise Ones,
On all but one of my workbooks I need the cursor
to move to the right after pressing Enter on the numeric keypad to save
inputted data. On one sheet I would like it to move down on Enter. Is there a
way for excel to recognize and change the movement on one sheet, but behave
normally (according to the options setting) in other workbooks automatically?

Thanks,
Mike

Chip Pearson

Change Enter key movement in one workbook only
 
Put the following code in the ThisWorkbook code module of the workbook in
which you want the direction to be down.

Option Explicit

Private MoveDir As XlDirection

Private Sub Workbook_Activate()
MoveDir = Application.MoveAfterReturnDirection
Application.MoveAfterReturnDirection = xlDown
End Sub


Private Sub Workbook_Deactivate()
If MoveDir = 0 Then
MoveDir = xlToRight
End If
Application.MoveAfterReturnDirection = MoveDir
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Mike K" wrote in message
...
Oh Wise Ones,
On all but one of my workbooks I need the cursor
to move to the right after pressing Enter on the numeric keypad to save
inputted data. On one sheet I would like it to move down on Enter. Is
there a
way for excel to recognize and change the movement on one sheet, but
behave
normally (according to the options setting) in other workbooks
automatically?

Thanks,
Mike



Mike K

Change Enter key movement in one workbook only
 
Thanks Chip!

"Chip Pearson" wrote:

Put the following code in the ThisWorkbook code module of the workbook in
which you want the direction to be down.

Option Explicit

Private MoveDir As XlDirection

Private Sub Workbook_Activate()
MoveDir = Application.MoveAfterReturnDirection
Application.MoveAfterReturnDirection = xlDown
End Sub


Private Sub Workbook_Deactivate()
If MoveDir = 0 Then
MoveDir = xlToRight
End If
Application.MoveAfterReturnDirection = MoveDir
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Mike K" wrote in message
...
Oh Wise Ones,
On all but one of my workbooks I need the cursor
to move to the right after pressing Enter on the numeric keypad to save
inputted data. On one sheet I would like it to move down on Enter. Is
there a
way for excel to recognize and change the movement on one sheet, but
behave
normally (according to the options setting) in other workbooks
automatically?

Thanks,
Mike




All times are GMT +1. The time now is 04:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com