Table of contents
TOC
Collapse the table of content
Expand the table of content

Invalid Next control variable reference

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

The numeric variable in the Next part of a For...Next loop must match the variable in the For part. This error has the following cause and solution:

  • The variable in the Next part of a For...Next loop differs from the variable in the For part. For example:
For Counter = 1 To 10 
MyVar = Counter 
Next Count 
Check the spelling of the variable in the  **Next** part to be sure it matches the **For** part. Also, be sure you haven't inadvertently deleted parts of the enclosing loop that used the variable.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

© 2017 Microsoft