Share via


Expected 'Next'

You created a For...Next loop construct, but did not properly terminate the loop. A For...Next loop construct must end with a Next statement. The following demonstrates the correct structure of a For...Next loop construct.

                      For counter = start To end [Step step]
    [statements]
    [Exit For]
    [statements]
Next

To correct this error

  • Make sure that the For...Next loop construct includes all the necessary parts.

See Also

Reference

For...Next Statement

Do...Loop Statement

Exit Statement

For Each...Next Statement

While...Wend Statement