56 free macros indexedAll toolsHow to runBlogGitHub ↗

How to Delete or Edit a Macro in Excel

To delete a macro in Excel, press Alt + F8, select it, and click Delete. To edit one, click Edit, change the code in the VBA editor, and save as .xlsm.

2026-09-02

How to delete or edit a macro in Excel

To delete or edit a macro in Excel, press Alt + F8 on Windows or Option + F8 on Mac to open the Macro dialog, select the macro, then click Delete to remove it or Edit to open its code in the Visual Basic Editor. Both buttons sit in the same dialog, which is why the two jobs belong in one guide.

The step that stops most people is not the dialog. It is a message saying the workbook is hidden, which appears when the macro lives in your Personal Macro Workbook rather than the file in front of you.

TL;DR: Key takeaways

  • Delete: Alt + F8, select the macro, click Delete, confirm.
  • Edit: Alt + F8, select the macro, click Edit, change the code, press Ctrl + S.
  • A "workbook is hidden" message means the macro is in PERSONAL.XLSB. Unhide it or delete the code in the VBA editor.
  • To strip every macro from a file at once, save it as .xlsx.
  • Edits are saved only if the file stays .xlsm. Saving as .xlsx throws the code away.

Delete a macro from the Macro dialog

This removes one macro and leaves the rest of the workbook untouched. Microsoft's own steps are the same on Windows and Mac.

  1. Open the workbook that contains the macro.
  2. Press Alt + F8 (Windows) or Option + F8 (Mac).
  3. Select the macro name and click Delete.
  4. Click Yes to confirm, then save the workbook.

If the macro is not in the list, the workbook holding it is closed or the Macros in dropdown is filtered to a different file. Set it to All Open Workbooks.

When Excel says the workbook is hidden

If you click Delete and get a message that the workbook is hidden, the macro was saved to the Personal Macro Workbook. Microsoft describes PERSONAL.XLSB as a hidden workbook stored on your computer that opens every time you start Excel, so it is always present but never visible.

You have two ways through:

  • Unhide it first. Go to View > Unhide, choose PERSONAL.XLSB, then delete the macro from the Macro dialog as normal. Hide it again afterwards from View > Hide.
  • Delete the code directly. Press Alt + F11, find PERSONAL.XLSB in the Project Explorer on the left, expand Modules, open the module, and delete the macro's code from Sub to End Sub.

Remove every macro by saving as .xlsx

If you inherited a workbook and want the macros gone entirely, do not delete them one by one. Save the file as a macro-free workbook instead.

  1. Go to File > Save As.
  2. Change the file type to Excel Workbook (*.xlsx).
  3. Click Save, and click Yes when Excel warns that the VBA project cannot be kept in a macro-free workbook.

The .xlsx copy has no macros, no security banner, and no way to run VBA. Keep the original .xlsm if you might want the code back, and see XLSM vs XLSX for which format to use when.

Edit a macro in the Visual Basic Editor

Editing means changing the code, not re-recording it. The Edit button in the Macro dialog opens the Visual Basic Editor at that macro, and Microsoft notes you can press F5 there to run the changed macro straight from the editor.

  1. Press Alt + F8, select the macro, click Edit.
  2. Change the code. Small edits to a number, a text string, or a colour are the safest starting point.
  3. Press Ctrl + S to save. The file must stay .xlsm or the edit is lost.
  4. Close the editor and run the macro to test it.

A concrete example: the Highlight Duplicates macro fills matching cells with a light red set by the line cell.Interior.Color = RGB(255, 199, 206). Change those three numbers to RGB(255, 235, 156) and the same macro highlights in yellow. That is the whole edit.

Every tool on this site ships its VBA as a plain .bas file, so you can read the code before touching it, and import it into a workbook of your own if you would rather start from the source. If you are new to reading VBA, the macros guide for non-coders explains what the common lines do.

Frequently asked questions

How do I delete a macro in Excel that won't delete?

The Delete button fails when the macro lives in the hidden Personal Macro Workbook. Go to View > Unhide, pick PERSONAL.XLSB, then delete the macro from the Macro dialog. Or press Alt + F11 and remove the code from the PERSONAL.XLSB module directly.

Does saving as .xlsx delete all macros?

Yes. Excel warns that the VBA project cannot be saved in a macro-free workbook, and clicking Yes strips every macro from the new file. The original .xlsm is untouched, so keep it if you may want the code later.

Can I edit a macro without knowing VBA?

For small changes, yes. Numbers, text strings, and colour values are readable even if the rest is not. Change one value, save, and test on a copy of your data. Leave the structure of the code alone unless you understand what it does.

Can I delete or edit a macro in Excel for the web?

No. Microsoft confirms that Excel for the web cannot create, run, edit, or delete VBA macros. It also shows no warning that a workbook contains them. Open the file in desktop Excel to do either.

Where is the Personal Macro Workbook stored?

On Windows it is PERSONAL.XLSB in C:\Users\<your name>\AppData\Local\Microsoft\Excel\XLStart. Excel opens it hidden at startup, which is why its macros appear in every workbook and why you cannot delete them until it is unhidden.

What to do next

Deleting and editing are the two most common reasons to open the Macro dialog after running a macro you downloaded. If the dialog is empty because the file was blocked on opening, enabling macros when there is no enable button covers that first. Try a colour edit on any macro in the free tools library to get comfortable with the editor.