Table of Contents

VBC00059: You must terminate the #If block with an #EndIf

Severity: Error  ·  Family: VBC (parser / concrete syntax tree)  ·  Source metadata: VBSyntaxErrorInfo

A #If block is not ended: the module ends before its #End If.

An #End If with text after it, other than a comment written with ', is no directive, and ends nothing: #End If Rem c ends nothing either. Such a line is a syntax error of its own too (VBC00001). #EndIf, written as one word, ends the block.

MS-VBA reports the same error, with the same message (recorded in Excel).

This code is raised by the parser, at the #If of each block that is not ended. MS-VBA puts its caret on the module's last line.

How it is raised

Situation Example Resolution
No #End If. #If VBA7 Then … (end of the module) Write the #End If that ends the block.
Text after the #End If. #If Mac Then … #End If junk Remove the text, or make it a comment.

See also


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