Excel: INSERT(2) in Macro Repeats INSERT Command Continuously

Last reviewed: November 29, 1994
Article ID: Q32363
The information in this article applies to:
  • Microsoft Excel for the Macintosh, versions 1.x, 2.2, 3.0, 4.0

SUMMARY

In Microsoft Excel, if there is an =INSERT(2) command below the current active cell, the macro will repeatedly insert a cell. This behavior occurs because of the way Microsoft Excel internally tracks which macro statement was just executed. Microsoft Excel keeps track of this information by remembering the cell reference.

NOTE: This behavior will occur only if the macro is run with the macro sheet active and with the cell containing the INSERT() command located below the active cell on the sheet.

When the insertion is done, the active cell is now the new blank cell that was inserted. Microsoft Excel then moves to the next cell to execute the next command. The next command is the INSERT() command because it was moved down with the previous INSERT() command.

This feature is by design. To reproduce this behavior, create the following macro:

   A1: Record1
   A2: =INSERT(2)
   A3: =RETURN()

Select cell A1 on the macro sheet and run the macro (leaving the macro sheet active). The macro statements will move down column A until the macro is canceled or it reaches row 16,384. To cancel the macro, press COMMAND+. (PERIOD) or ESC (the ESCAPE key on an extended keyboard).


KBCategory: kbother
KBSubcategory:

Additional reference words: 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.2 2.20
3.0 3.00 4.0 4.00 macrosheet


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 29, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.