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.

One Comment

Leave a Reply