Howto prevent the ENTER key on the number pad from moving the selection when using Excel for Mac (283879)



The information in this article applies to:

  • Microsoft Excel X for Mac
  • Microsoft Excel 2001 for Mac
  • Microsoft Excel 2004 for Mac

This article was previously published under Q283879

SUMMARY

In Microsoft Excel 2001 for Mac and later, when you press ENTER on the number pad to enter a value, the current selection (active cell pointer) moves in the same direction as it does when you press RETURN.

In earlier versions of Excel for the Macintosh, such as Microsoft Excel 98 Macintosh Edition, the ENTER key does not move the selection.

MORE INFORMATION

In Excel 98, RETURN and ENTER are considered two distinct keys: RETURN is on the keyboard, and ENTER is on the numeric keypad. In Excel 98, RETURN moves the selection, but ENTER does not.

In Excel 2001 and later versions, ENTER moves the selection the same direction as RETURN. When you press RETURN, the selection moves as if the Move selection after Return check box is selected (the default setting). To modify this setting, click Preferences (on the Edit menu in Excel 2001 or on the Excel menu in Excel X and later versions), and then click the Edit tab (or the Edit button in Excel X). You can also change the Direction setting from Down (the default), to Up, Left, or Right.

Macro to Prevent ENTER from Moving the Selection

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following sample macros change the behavior of ENTER so that it does not change the selection, and does not behave like RETURN. These macros allow the RETURN key to follow the Move selection after Return setting, but allow ENTER to behave the way it does in Excel 98.

NOTE: To automatically have this functionality when you start Excel, you must store these macros in the Personal Macro Workbook.
   Sub Auto_Open()
       Application.OnKey "{ENTER}","ENTER_Key"
   End Sub

   Sub ENTER_Key()

   End Sub
				
Although the ENTER_Key macro does not contain any code, calling the macro prevents the default behavior of changing the selection.

Modification Type:MajorLast Reviewed:6/30/2005
Keywords:kbhowto KB283879