To edit a macro that is attached to a Microsoft Excel workbook, you use the Visual Basic Editor.
In this article
Make the Developer tab visible
Commands that you use to edit and run macros are found in the Code group of the Developer tab, which is hidden by default. To make the Developer tab visible, do the following:
Click the File tab, and then click Options.
Click the Customize Ribbon category.
Under Customize the Ribbon, in the Main Tabs list, click Developer, and then click OK.
Change macro security settings
To edit and run macros, you must set the security level to temporarily enable all macros:
On the Developer tab, in the Code group, click Macro Security.
Under Macro Settings, click Enable all macros (not recommended, potentially dangerous code can run), and then click OK.
Note To help prevent potentially dangerous code from running, we recommend that you return to any of the settings that disable all macros after you finish working with macros.
Start editing the macro
On the Developer tab, in the Code group, click Macros.
In the Macro name box, click the macro that you want to edit.
Click Edit. The Visual Basic Editor appears.
Tip To get help while you are working in the Visual Basic Editor, on the Help menu, click Microsoft Visual Basic Help, or press F1.