You created a For...Next or a For Each...Next construct, but did not include the For statement. For example, you could have attempted to remove a For...Next construct, but did not remove the Next statement. The following demonstrates the correct usage of the For...Next construct.

CopyCode imageCopy Code
Forcounter=startToend [Stepstep]
    [statements]
    [Exit For]
    [statements]
Next

To correct this error

  • Add the For statement (the loop control statement).

  • Remove the extra Next statement.

See Also