Next control variable does not match For loop control variable '<variablename>'

The control variable in the Next statement of a For...Next loop must match the variable in the corresponding For statement.

Error ID: BC30070

To correct this error

  1. Check the spelling of the variable in the Next statement and in the corresponding For statement to be sure it matches.

  2. Ensure that no parts of the enclosing loop have been inadvertently deleted.

  3. If this loop is part of a set of nested loops, check that every loop is properly terminated.

See Also

Reference

For...Next Statement (Visual Basic)