Excel: {ENTER} with ON.KEY Differs Between Versions

Last reviewed: November 3, 1994
Article ID: Q79086
The information in this article applies to:
  • Microsoft Excel for Windows, version 2.x, 3.0, 4.0, 4.0a, 5.0

SUMMARY

When you use the ON.KEY function with "{ENTER}" or "~" as the key text, the ENTER key needs to be pressed twice in Microsoft Excel version 2.1 to run the macro specified. The ENTER key only needs to be pressed once in Microsoft Excel versions 3.0, 4.0, 4.0a, or 5.0 to cause the macro to run.

MORE INFORMATION

The following macro, which displays an alert box when the ENTER key is pressed, illustrates the differences in the two versions.

Steps to Reproduce Problem

  1. Enter the following into a macro sheet in Excel version 3.0 or 4.0:

          A1: =ON.KEY("~","R4C1")
          A2: =RETURN()
          A3:
          A4: =ALERT("testing")
          A5: =RETURN()
    

  2. Select cell A1. Choose Run from the Macro menu.

  3. Select cell B1. Type "Test" and press the ENTER key.

In Excel versions 3.0 or 4.0, the alert box will display. In Excel version 2.1, the ENTER key will have to be pressed a second time to get the alert box to display.

Note that the problem occurs in version 2.1 only when the formula bar is active. If the ENTER key is pressed when the formula bar is not active, it needs to be pressed only once to display the alert box.

Note that the problem also occurs when using "{ENTER}" in place of "~"; however, "{ENTER}" corresponds with the numeric keypad's ENTER key in Excel 3.0 or 4.0, and NOT the ENTER key on the keyboard. In version 2.1, it corresponds with either ENTER key.

REFERENCES

"Microsoft Functions Reference Manual," version 3.0, page 165

"Microsoft Functions and Macros," version 2.1, page 321


KBCategory: kbusage
KBSubcategory:

Additional reference words: 2.10 2.10c 2.10d 2.1 2.1c 2.1d 3.00 4.0
4.00 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.