We help IT Professionals succeed at work.

In VBA how to I restore the Enter key to its original behavior after remapping it?

shampouya
shampouya asked
on
I used Application.OnKey to change the behavior of the Enter key. But once I tried to remove that behavior using the below, the enter keys no longer move the active cell one cell down as they do normally when pressed. How do I restore that without rebooting Excel?

Application.OnKey "~", ""
Application.OnKey "{ENTER}", ""

Open in new window

Comment
Watch Question

Top Expert 2014
Commented:
You reset the OnKey action by omitting the second parameter.
Example:
application.OnKey "{ENTER}", "NewEnter"    'override action
application.OnKey "{ENTER}"                          'reset

application.OnKey "~", "NewEnter"    'override action
application.OnKey "~"                          'reset

Open in new window

Author

Commented:
Exactly what I needed, thanks!