Skip to content

VBA201 — Jump target is not a label

Severity: 🔴 error Category: jump Phase: 2.1

Description

A GoTo / On Error GoTo / Resume / GoSub references a label that is not declared in the procedure.

Failing example

Sub S()
    GoTo NoSuch
End Sub

Compliant example

Sub S()
    GoTo Skip
Skip:
End Sub

How to fix

Declare the label or fix the spelling. Special forms On Error GoTo 0, On Error GoTo -1, and On Error Resume Next do not need a target.


Source: src/rules.py — entry VBA201.