Skip to content

VBA350 — Procedure terminator does not match its kind

Severity: 🔴 error Category: syntax Phase: 3.5

Description

End Sub closes a Sub, End Function closes a Function, End Property closes a Property. Mixing them is a hard VBE compile error and a common AI-generator slip after editing a procedure's signature.

Failing example

Function F() As Long
    F = 1
End Sub

Compliant example

Function F() As Long
    F = 1
End Function

How to fix

Use the End form that matches the procedure declaration.


Source: src/rules.py — entry VBA350.