• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Automating Tasks with Macros > Editing Macros in Visual Basic Edito...

Editing Macros in Visual Basic Editor

If you run a macro and it does not perform the desired task as you intended it to, you do not need to re-record the macro. Instead, you can modify the macro’s recorded commands in Visual Basic Editor or delete commands you inadvertently recorded. To open a macro and edit it in the Visual Basic Editor, follow these steps:

1.
If you saved the macro you want to edit in a particular workbook, open the workbook file in which you created and saved the macro.

2.
Open the Tools menu, point to Macro, and choose Macros. The Macro dialog box appears, as shown in Figure 13.8.

Figure 13.8. You can edit any recorded macro.


3.
Click the name of the macro you want to edit.

4.
Click the Edit button. Visual Basic Editor appears and displays the commands that compose the selected macro, as shown in Figure 13.9.

Figure 13.9. Use Visual Basic Editor to edit your macro.


5.
To delete a command or any text, drag over the command or text to highlight it and then press the Delete key.

6.
To add a command or text, type the command or text where you want it to “play” in the macro.

7.
To save your macro, open the File menu and choose Save, or press Ctrl+S.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint