Microsoft KB Archive/51542

{| = Excel: Macro Error on FOR or WHILE Loop Statement =
 * width="100%"|

Last reviewed: November 2, 1994

Article ID: Q51542

SUMMARY
When Microsoft Excel encounters a FOR or WHILE statement, it looks ahead for the accompanying NEXT statement. If the NEXT statement is missing or entered incorrectly, a macro error will be returned, giving the reference of the cell containing the FOR or WHILE statement.

If you are encountering a macro error on either a FOR or WHILE statement, check to see that the accompanying NEXT statement is present and correctly entered.
 * }