Use a split module to work more productively in the Visual Basic Editor

Using VBA to automate or customize a task is hard enough without working in the cramped module window. If you need to see more of your code than the view allows, split the window and get two views in the same space meant for one.

An extra pair of hands and a monitor would come in nicely when you're writing code. That's because you often want to compare or work with different parts of the code at the same time. For instance, you might want to review an earlier expression or declare a new variable. To do so, you must scroll to the appropriate spot, review the expression or make your change, and then scroll back to where you were previously working. It's time-consuming and tedious, especially if you're scrolling through several lines of code.

Instead of scrolling, split the module window, the same way you split a document window. Simply drag the Split bar (that small rectangle at the top of the scroll bar) down. Or choose Split from the Window menu.

The Visual Basic Editor (VBE) will split the module, providing access to different views of the same code. That means you can scroll up and down in one while maintaining a fixed position in the other. With the module split, you can quickly navigate to code that would otherwise be out of sight by simply moving between the two panes. A quick click inside either pane provides access to that pane. You can also press[Shift]+[F6] to jump from one pane to another.

To remove the split screen, uncheck Split on the Window menu or drag the Split bar beyond the window's top margin. Easier still, just double-click the Split bar.

About Susan Harkins

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks

Free Newsletters, In your Inbox