Disable Enter key in specific excel file

Andreas1

New Member
Joined
Oct 2, 2011
Messages
17
Hello to all!

Hope you can help me. I have an issue in an excel file that i want to disable 'enter' so users can navigate in excel sheets with arrows only.

is there a simple way to de-activate the enter key only for the specific excel file (lets call it test.xlsx

thanks!!
Andreas
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
It is more complicated than you may may think and requires VBA
The command is simple enough
Code:
Application.MoveAfterReturn = False

BUT
- the property is set at application level NOT workbook level
- once set the property must either be reset to True or Excel closed and re-opened
- the workbooks requiring this need to be macro enabled
- the code must be placed in ThisWorkbook module of each relevant workbook (not a standard module)
- ensure that property set to False whenever workbook is active and to True when the workbook is either closed or deactivated

Code:
Private Sub Workbook_Open()
    Application.MoveAfterReturn = False
End Sub

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    Application.MoveAfterReturn = False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.MoveAfterReturn = True
End Sub

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
    Application.MoveAfterReturn = True
End Sub
 
Last edited:
Upvote 0
Do you want the user to be able to enter values in cells?
If not, sheet protection will prevent that.
 
Upvote 0

Forum statistics

Threads
1,224,742
Messages
6,180,685
Members
452,993
Latest member
FDARYABEE

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top