1-866-245-5224 sales@keystonelearning.com

Excel 2003: Edit a Macro

Excel 2003: Edit a Macro

Before you try to edit a macro, you should be familiar with the Visual Basic Editor. This doesn’t mean you need to know how to write Visual Basic script and this certainly isn’t a Visual Basic course, but it will help you out tremendously if you can, at the very least, read the language.

So, before you edit your first macro, take a few minutes to review the parts of a macro as seen through the eyes of Visual Basic. We’ll use the contents of a simple macro that contains all the parts we need to learn how to read this script.

Figure 25. Sample Macro Code

               

The entire script starting with the word Sub and ending with End Sub is called a Procedure. In our case, every procedure should begin with the word “Sub” and end with the words “End Sub.”

               

Next to the word “Sub” should be the name of the macro, in this case “My First Macro ()”

               

The text preceded by the apostrophe (‘) is considered a comment.

               

Everything in the middle is what you macro is doing when it runs.

 Editing a Macro

     
  1. Choose Tools: Macro: Macros… from the Menu bar
     
  2.  
  3. Select the macro you want to edit
     
  4.  
  5. Click Edit