次の方法で共有


Unexpected 'Next'

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.

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

To correct this error

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

  • Remove the extra Next statement.

See Also

Concepts

Looping Through Code

Reference

For...Next Statement

For Each...Next Statement

Exit Statement