Skip to content

VBA116 — Next without For

Severity: 🔴 error Category: syntax Phase: 1.5

Description

A Next appears with no For loop open in scope.

Failing example

    Debug.Print i
Next i

Compliant example

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

How to fix

Remove the stray Next or add the opening For.


Source: src/rules.py — entry VBA116.