Establishing Subroutines

A subroutine is a collection of VBA statements that, taken together, accomplish something. The term is a little unfortunate, implying that it is subordinate to something. The meaning is broader than that, though: A subroutine can be the main, top-level code in your project, or it can be a set of code that accomplishes some smaller task on behalf of the main code.

Providing the Subroutine's Basic Elements

In VBA, subroutines are stored in modules, and establishing a module is where it all starts. To establish a module you need to start the VBE.

From the main Excel window, one way to get to the VBE is by choosing Macro from the Tools menu, and then selecting Visual Basic Editor from the shortcut menu. As you become more ...

Get Managing Data with Microsoft® Excel now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.