To edit a macro that you attached to a Microsoft Excel workbook, use the Visual Basic Editor.
Important
Before you can work with macros, you need to enable the Developer tab. For more information, see Show the Developer tab.
Change macro security settings
To edit and run macros, set the security level to temporarily enable all macros:
On the Developer tab, in the Code group, select Macro Security.
Under Macro Settings, select Enable VBA macros (not recommended, potentially dangerous code can run), and then select OK.
Warning
To help prevent potentially dangerous code, return to any of the settings that disable all macros after you finish working with macros.
Edit the macro
- On the Developer tab, in the Code group, select Macros.
- In the Macro name box, select the macro that you want to edit.
- Select Edit. The Visual Basic Editor opens.
Tip
To get help while working in the Visual Basic Editor, on the Help menu, search for Microsoft Visual Basic Help, or press F1.