'Next' must be preceded by a matching 'For'

A Next statement occurs without a corresponding For or For Each statement. Next must be preceded by a corresponding For or For Each statement.

Error ID: BC30092

To correct this error

  1. If this For loop is part of a set of nested For loops, make sure each loop is properly terminated.

  2. Verify that other control structures within the For loop are correctly terminated.

  3. Ensure that this For loop is correctly formatted.

See Also

Reference

For...Next Statement (Visual Basic)

For Each...Next Statement (Visual Basic)