VBC00047 — End If without block If
Severity: Error · Family: VBC (parser / concrete syntax tree) ·
Source metadata: VBSyntaxErrorInfo
An End If statement ends no block If.
An End If statement ends the block If it is written in - one whose Then ends its line. A single-line If has no End If.
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 End If with no block If. |
End If alone in a procedure |
Remove it, or write the If … Then it ends. |
An End If after a single-line If. |
If x Then y = 1 … End If |
Break the If after its Then, or remove the End If. |
See also
⏮️ VBC00046 Do without Loop | ⏭️ VBC00048 Block If without End If
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca