Search DaTutorials:  
HOME
VB Script Tutorials
Introduction
Reference
Tutorials

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

For...Next Statement | For Each...Next Statement | Looping Through Code | Exit Statement


     Per Insurance | Internet Advertising | Loans | Loan | Currency Converter
Home     Link To Us     Ad With Us     Contact Us     Tell A Friend     Affiliates     Blog     MsOfficeHelp