Excel: Using the Numeric Keypad with the ON.KEY Function

ID: Q78337


The information in this article applies to:


SUMMARY

The Microsoft Excel ON.KEY function is used to run a specified macro when a particular key or key combination is pressed. With the exception of the Enter key in Microsoft Excel version 3.0, the ON.KEY function cannot distinguish the numeric keypad keys from the main keyboard equivalents. In addition, some of the operators on the numeric keypad cannot be used as arguments to the ON.KEY function.


MORE INFORMATION

The keys PLUS SIGN (+), MINUS SIGN (-), ASTERISK (*), BACKSLASH (/), and EQUAL SIGN (=) on the numeric keypad cannot be mapped separately from their equivalent keys on the keyboard. Keep the following in mind when using the ON.KEY command:

  1. If you try to map the PLUS SIGN (+) key results, a macro error is generated because the PLUS SIGN has been designated for key combinations. This operator will not work when executed from either the numeric keypad or the keyboard.


  2. The EQUAL SIGN (=) key runs the assigned macro from both the keyboard and numeric keypad (if your numeric keypad has an EQUAL SIGN key).


  3. The MINUS SIGN (-), ASTERISK (*), and BACKSLASH (/) keys run the assigned macro only if the keys are entered from the keyboard.


NOTE: None of the above keys will run a macro if they have been entered as the alternate menu or help key. This key is specified by choosing the Options menu, selecting Workspace, and entering the key in the Alternate Menu or Help Key text box.

For more information on using the ON.KEY function with the Enter key, query on:


   "numeric keypad" and on.key and enter and excel 


REFERENCES

"Online Help," version 5.0
"Function Reference," version 4.0, pages 302-303
"Function Reference," version 3.0, pages 165-67

Additional query words: 2.1 3.0 4.0 4.00a 5.0


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: March 22, 1999