Using VBA Macros in Excel can be a huge time saver. You can automate a lot of repetitive tasks and create new functions and functionalities in Excel with simple VBA macro codes.
But in some cases, you may want to remove all the macros from an Excel workbook (or delete specific macros only).
This may be the case when you get a workbook from someone else and you want to make it macro-free, or when you’re sending a file with macros to someone and the receipt doesn’t need these in the workbook.
In this tutorial, I will show you a couple of really simple ways to remove macros from a workbook in Microsoft Excel.
So let’s get started!
This Tutorial Covers:
ToggleRemove All Macros by Saving the File in XLSX format
If you want to get rid of all the macros at once, the easiest way to do this would be to save the existing workbook with the XLSX format.
By design, you can not have any VBA macro code in the XLSX file format. In case you do, it would be removed automatically while saving the Excel file.
With Excel, you can only have the macros in the .XLSM, .XLSB, and the older .XLS formats. When you save the workbook in any other format, the macros are immediately lost.
Suppose you have a file called Example.xlsm (with macros), below are the steps to remove all the macros from this file:
- Click the File tab
- Click on ‘Save As’ option (it’s ‘Save a Copy’ in new Excel versions)
- Click on Browse. This will open the Save As dialog box.
- In the Save As dialogue box, enter the name of the file with which you want to save it. You can also keep the existing name if you want
- Click on the Save As type drop-down
- Select the Excel Workbook (*.xlsx) option
- Click on Save
- In the prompt that appears, click on Yes. It’s just informing you that the VB Code will be lost if you save this file in the .XLSX format.
That’s it! Your file is now macro-free.
This method is great as it removes all the macros from the current Excel workbook in one go. However, if you want to remove some macros and delete some, this method will not work for you (see the one using the Macro dialog box for this).
Another good thing about this method is that you still have a copy of the original file that has all the macros (in case you need it in the future).
Also read: How to Remove Hyperlink in Excel
Remove Specific Macros from the Macro dialog box
While the previous method would delete all the macros. this one allows you to choose the ones that you want to be removed.
And in case you want to delete all the macros, you can do that as well.
Suppose you have a file called Example.xlsm that has some macros.
Below are the steps to delete a macro from this workbook:
- Click the Developer tab (in case you don’t see the Developer tab, see the note in yellow after the steps)
- Click on the Macros button. This will open the Macro dialogue box where you can see all the macros in the workbook
- In the ‘Macros in’ drop-down, make sure ‘This Workbook’ is selected.
- Select the macro name that you want to delete from the macro list
- Click on the Delete button. This will delete that selected macro
If you want to remove multiple (or all) macros, repeat steps 4 and 5.
Note: In case you don’t see the developer tab, click here to read on how to get the developer tab to show up in the ribbon in Excel. Alternatively, you can also use the keyboard shortcut – ALT + 8 to open the Macro dialog box.
Alternatively, you can also click on the Views tab, click on the Macros drop-down and then click on View Macros option. This will also open the Macros dialog box.
While this method works great, it would only allow you to remove macros that are stored in a module in the Visual Basic Editor. In case you have event macros (in specific worksheets or ThisWorkbook) or macros in the personal macro workbook, those can not be removed with this method.
Also read: How to Remove Add-Ins in Excel
Remove the Module that has the Macro
Another way to remove macros is to go to the Visual Basic Editor and remove macros from there.
This method gives you the most control as you can access all the macros (be it in the module or objects or personal macro workbook).
Below are the steps to delete a macro from the Visual Basic Editor:
- Click on the Developer tab in the ribbon
- Click on Visual Basic option (or use the keyboard shortcut – ALT + F11)
- In the VB Editor, you will have all the workbook objects in the Project Explorer. If you don’t see the Project Explorer, click on the View option in the menu and then click on Project Explorer
- In the Project Explorer, double click on the object that has the macro code. This could be a module, a worksheet object, or ThisWorkbook.
- In the code window that opens, delete the macros you want to remove. If you want to remove all, just select everything and hit the delete key.
In case you have a module that has the code that you want to remove, you can right-click on the module object and then click on Remove module option.
So these are three ways you can use to remove macros from a Microsoft Excel workbook.
I hope you found this tutorial useful!
Other Excel tutorials you may like:
1 thought on “How to Remove Macros From an Excel Workbook (3 Easy Ways)”
Hi, I’m not sure if you handle my type of inquiry.
Recently my Norton AV quarantined all my Excel spreadsheets claiming that they were infected with something called “XLS:Nastya [Trj]”. Those spreadsheets contain important, for me, information gathered for very long time. Norton indicates that these files should be removed (deleted) from the computer. Needless to say that’s not an option for me to consider. Would you happen to have any ideas how this situation can be rectified?
Than you for your attention.
Richard