Skip to content

VBA119 — Block terminator without matching opener

Severity: 🔴 error Category: syntax Phase: 1.5

Description

A block terminator (Else, ElseIf, End If, End Select, End With, …) appears with no matching opening statement in scope — typically the symptom of an earlier mis-nested block.

Failing example

Debug.Print 1
End If

Compliant example

If x > 0 Then
    Debug.Print 1
End If

How to fix

Fix the surrounding block nesting; an opener is missing or an earlier block closed too early.


Source: src/rules.py — entry VBA119.