Microsoft Office Tutorials and References
In Depth Information
CREATE A REGULAR MACRO
CREATE A REGULAR MACRO
Challenge: You’ve found a cool VBA macro on the MrExcel message board.
Your workbook doesn’t currently have any macros. How can you get the macro
into your workbook?
Solution: You can type regular macros in a module in the VBA editor. Follow
these steps to insert a new module:
Open the workbook in which you want to save the macro.
Switch to the VBA editor by pressing Alt+F11. Alternatively, you could select
Tools, Macro, Visual Basic Editor in Excel 2003 or Developer, Visual Basic
in Excel 2007.
From the VBA editor menu, choose Insert, Module. A new blank code pane
appears on the right side of the screen.
Copy the code from the webpage. Click in the blank code module and
choose Paste.
If it is not already visible, display the Project Explorer by pressing Ctrl+R. In
the Project Explorer, you should be able to see the Module1 entry listed below
your workbook. If you plan to have several macros, you can organize them
into multiple modules. To rename a module from a generic name, follow these
steps:
Display the Properties window by pressing F4.
Click Module1 in the Project Explorer.
The Properties window shows only one property: (Name).
Click in the text box for ( Name ) and type a new name , such ad
ModuleReports.
As you add modules, you can name them to make it easier to locate particular
macros later (Figure 122).
1.
2.
Part
3
3.
4.
1.
2.
3.
4.
Figure 122. Organize your modules by
changing their name in the Properties
window.
 
 
Search JabSto ::




Custom Search