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

Last reviewed: November 3, 1994
Article ID: Q78337
The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.1, 3.0, 4.0, 4.0a, 5.0

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


KBCategory: kbusage
KBSubcategory:

Additional reference words: 2.1 2.10 3.0 3.00 4.0 4.00
4.0a 4.00a 5.0 5.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 3, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.