Select Entire Sub or Function in VBA with a Double-Click
Yet another hidden feature of the VBA editor that eluded me for more than fifteen years.
I had been programming in VBA for over 15 years before I learned this trick (yesterday).
If you double-click in the left margin of a procedure block in VBA, the entire procedure will get selected.
I knew that a single-click in this area would select an entire line, but somehow I never noticed that double-clicking would select the whole thing. Check out the demo below:
Don't Feel Left Out
If, like me, you have been writing code in VBA for years and didn't know this feature existed, don't feel too bad. We're in good company.
I first learned about this when KarlSevenSeven introduced it as a feature request for twinBASIC. Apparently, he had also just learned about it on a forum only a few days earlier. Several of the VBA/VB6 experts over there (including twinBASIC creator himself, Wayne Phillips) were not aware of this feature either:
It's amazing how something so simple could have been overlooked by so many developers for so many years.
It makes you wonder what else might be out there... 🤔