Table of Contents

RDC11036: Negative line number

Severity: Warning  ·  Family: RDC (Rubberduck Core analyzers)  ·  Raised by: NegativeLineNumberAnalyzer

A line number is below 0: a line is numbered -5:, or a GoTo, GoSub, Resume or On Error GoTo jumps to -5.

A line number of MS-VBAL §5.4.1.1 is a decimal literal, with no sign. MS-VBA compiles a line number with a minus, and so does RD-VBA (RD-VBAL §5.4.1.1 Statement Labels). The VBE can write one when it shows a hexadecimal line number such as &HFFFFFFFB as a decimal number.

On Error GoTo -1 names no line, and is not reported here: it is RDC00211.

The finding is the line number.

How it is raised

Situation Example Resolution
A line numbered below 0. -5: Number the line with a positive number, or give it a line label.
A jump to a line number below 0. GoTo -5 Jump to the renumbered line, or to its label.

See also


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca