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

ID: Q79086


The information in this article applies to:


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



Additional query words:


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: March 23, 1999