Select Entire Module in VBA With Control + Click

Learn 4 different ways to select the entire contents of a VBA module, plus a bonus keyboard shortcut tip for switching between two active code modules.

Select Entire Module in VBA With Control + Click

In yesterday's article, I wrote about how you can select an entire VBA procedure by double-clicking in the left margin between the breakpoint area and the code area (highlighted in red below):

It turns out, that if you [Ctrl] + [Left-Click] in the same "mouse target area" shown above, that VBA will select the contents of the entire module.

Alternatives for Selecting an Entire Module

While this is an interesting feature, I'm not sure I'll end up using it much.

The mouse target area (as shown above) is relatively narrow and there are several keyboard-only alternatives that I find more efficient:

  • [Ctrl] + [Home], [Ctrl] + [Shift] + [End]: go to top of the module and select to the end
  • [Ctrl] + [End], [Ctrl] + [Shift] + [Home]: go to bottom of the module and select to the top
  • [Ctrl] + [A]: Select All

Source of the Tip

Juanjo Luna, the newest Access MVP, discovered this feature after playing around with my tip from yesterday:

Here's the Spanish-language video he references in the above LinkedIn comments (auto-generated English captions available):

In addition to the Ctrl + Click feature, Juanjo also covers several other tips for navigating the VBA IDE, including a quick way to switch back and forth between two active code modules:

  • [Alt] + [W], [2]: Window > 2nd most recently used window ("1" refers to the active window)