Last updated: July 18, 2008 11:59 PM
![]()
Excel -- VBA -- Adding Code to a Workbook
Copy Code to a Regular Module
Copy Code to a Worksheet Module
Copy Code to a Workbook Module
Copy Code to a Regular ModuleYou may find code in a newsgroup message, or on a web site, and decide to add it to one of your workbooks. Most code can be added by doing the following:
- Copy the code that you want to use
- Select the workbook in which you want to store the code
- Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
- Choose Insert | Module
- Where the cursor is flashing, choose Edit | Paste
To run the code:
- Choose Tools | Macro | Macros
- Select a macro in the list, and click the Run button
Watch the Video
View the steps described above, in a short video clip.