Magic Colon

Here’s a new one on me via some Access MVPs. Type this:

Sub test()
 
If True Then
    Debug.Print
    Else Debug.Print

and you’ll get this

Sub test()
 
If True Then
    Debug.Print
    Else: Debug.Print

The VBE automagically makes the Else line a multi-statement line by inserting a colon. Just when you think you know a program. Now that I know it, I’ll still never use it.

Posted in Uncategorized

One thought on “Magic Colon


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.