Skip to content

VBA115 — Block If without End If

Severity: 🔴 error Category: syntax Phase: 1.5

Description

A block If … Then (the multi-line form, where Then is the last token on the line) reached the end of the procedure without a matching End If.

Failing example

If x > 0 Then
    Debug.Print x

Compliant example

If x > 0 Then
    Debug.Print x
End If

How to fix

Add the End If, or convert to a single-line If x > 0 Then Debug.Print x.


Source: src/rules.py — entry VBA115.