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

ID: Q32363


The information in this article applies to:


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).

Additional query words: 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.20 3.0 4.00 macrosheet


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: March 12, 1999