Invalid Next control variable reference
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).
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.