VBC00049 — Else without If
Severity: Error · Family: VBC (parser / concrete syntax tree) ·
Source metadata: VBSyntaxErrorInfo
An Else statement belongs to no block If.
An Else statement on a line of its own belongs to the block If it is written in: where none is open, it belongs to nothing.
MS-VBA reports the same error, with the same message (recorded in Excel).
This code is raised by the parser, at the statement that does not fit, when the grammar refuses a procedure whose blocks do not match. RD-VBA reports it for every procedure; MS-VBA stops at the first.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
An Else with no block If. |
Else alone in a procedure |
Remove it, or write the If … Then it belongs to. |
See also
⏮️ VBC00048 Block If without End If | ⏭️ VBC00050 Case without Select Case
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca