Edit a macro

You use the Visual Basic Editor to edit the macros attached to a workbook. On the Developer tab, in the Code group, click Macros, and in the Macro name box, click the macro you want to edit.

If you haven't edited a macro before, the first two sections in this article will get you started.

In this article

Show the Developer tab

Change macro security settings

Edit the macro

Show the Developer tab

The commands for editing and running macros are located on the Developer tab, which is hidden by default. To show the Developer tab, do the following:

  1. Click File, and then click Options.

  2. Click the Customize Ribbon category.

  3. Under Customize the Ribbon, in the Main Tabs list, click Developer, and then click OK.

Top of Page

Change macro security settings

To edit and run macros, you set your security level to temporarily enable them:

  1. On the Developer tab, in the Code group, click Macro Security.

    Code group on the Developer tab

  2. 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.

Top of Page

Edit the macro

  1. On the Developer tab, in the Code group, click Macros.

  2. In the Macro name box, click the macro that you want to edit.

  3. 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.

Top of Page

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!