Skip to content

VBA110 — For without Next

Severity: 🔴 error Category: syntax Phase: 1.5

Description

A For / For Each loop body reached the end of the procedure (or module) without a matching Next. VBE refuses to compile an unterminated loop.

Failing example

For i = 1 To 10
    Debug.Print i

Compliant example

For i = 1 To 10
    Debug.Print i
Next i

How to fix

Add the matching Next (optionally Next i) that closes the loop.


Source: src/rules.py — entry VBA110.