Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

To edit a macro that is attached to a Microsoft Excel workbook, you use the Visual Basic Editor.

Important: Before you can work with macros, you have to enable the Developer tab. For more information, see Show the Developer tab.

Change macro security settings

To edit and run macros, you must set the security level to temporarily enable all macros:

  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.

    Warning: 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.

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.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×