Remove Macros From an Excel Workbook

The quickest way to strip every macro from a workbook is to save it as .xlsx, a format that can't hold macros. To remove just one macro or module, delete it from the Macros dialog or the VBA editor.

All macrosSave As → Excel Workbook (*.xlsx)
One macroAlt + F8 → Delete
One moduleAlt + F11 → Remove Module

Which files hold macros?

Extension Macros?
.xlsx No
.xlsm Yes
.xlsb (binary) Yes
.xls (Excel 97–2003) Yes

1. Save as .xlsx (removes all)

  1. File → Save As → Browse.
  2. Under Save as type, choose Excel Workbook (*.xlsx) and click Save.
  3. Click Yes at the warning that the VB project will be lost.
Save as type set to Excel Workbook
Warning that macro-free workbooks can't hold a VB project

The original .xlsm file is untouched, so you keep a copy with the macros. The original post said (.xls) here; it should be .xlsx. Saving as .xls keeps the macros.

2. Remove a module

Press Alt + F11. In the Project pane, right-click the module (Module1 etc.) → Remove Module → No when asked to export it (or Yes to keep a backup .bas file).

Remove Module in the VBA editor

Code can also sit inside ThisWorkbook and each sheet. Double-click them and delete any code you find. Those can't be removed, only emptied.

3. Delete one macro

Press Alt + F8, select the macro, and click Delete.

Macros dialog with the Delete button

Things to know

  • Macros you recorded into the Personal Macro Workbook (PERSONAL.XLSB) run in every workbook. Delete them from VBAProject (PERSONAL.XLSB) in the VBA editor.
  • If a downloaded file's macros are blocked, Excel shows a red Security risk bar; that's protection, not something to remove.
  • Looking for macros to use? See the Excel macros library.

Related