Microsoft Office Tutorials and References
In Depth Information
Renaming a Module
renaming a Module
You’ve noticed that the Macro Recorder assigned the default name of Macro1 to the module it
created, and just now with Module2 you see how Excel continues to assign a sequential default name to
subsequent modules you insert. Yep, definitely a pattern going on here with the module names, but it
doesn’t mean those names need to stay that way.
A module name can be changed, and it makes a lot of sense to do so. This is especially true when
you have a complex workbook containing many macros in several modules, and you want the
module names to describe the overall themes of the macros they contain.
To change a module name, select it by clicking its original name in the Project Explorer. Notice
in the Properties window that the Name property of the selected module object is, as you would
expect, Module2. In the Properties window, use your mouse to select the entire module name
property, such as you see in Figure 4-7.
Now, it’s a simple task of typing over the selected Module2 text in the Properties window as you
enter whatever new name you want to give to that module. For this demonstration, name the
module Test. Just type the word Test and press Enter. The successful result is shown in Figure 4-8.