How do I get rid of VBA in Excel?

You have a lot of modules, userforms, and other code in a workbook and you want to delete it all at once. You could manually delete each one, one at a time, or you can use VBA to do all the work for you. 

If you need to make simple changes to a macro, such as inserting text or deleting a command, such as a specific format applied to a cell, you can edit the macro. You edit a macro in the Visual Basic Editor, shown in Figure 2-6. The elements of the Visual Basic Editor are described in the table below.

The Project Explorer, Properties window, and Code window all appear when you open the Visual Basic Editor. Since you won’t need the Properties window while performing simple editing, you can close the Properties window, and then expand the Project Explorer to view more of its window.

Each open workbook in Excel has a project associated with it in the Project Explorer. Navigating the Project Explorer is similar to navigating Windows Explorer, in that they both have hierarchical structures. The code for a macro is stored in a module, which is simply a holding place for the code, just as a worksheet is a holding place for data in cells. Double-clicking a module in Project Explorer displays the module’s code in the Code window. Editing Visual Basic code is similar to editing text in a word processing program.

For more details of Macro and VBA Excel training in Los Angeles call us on 888.815.0604. Our classes are hands-on and instructor-led. Beginner, Intermediate and Advanced Excel classes are also available.

How do I get rid of VBA in Excel?

Figure 2-6: The Visual Basic Editor

ElementDescriptionProject ExplorerContains projects that store the Visual Basic code for each open workbook. Each project can contain folders for objects (such as the worksheets in the workbook), forms, references, and modules. You select a module to view its code, copy modules to other open workbooks, and delete modules.Code windowDisplays the Visual Basic code for the selected module in a project.Properties windowDisplays specific characteristics of an object, such as the name of the object, or the standard width of the columns.Standard (macro) toolbarDisplays the basic tools needed to use the Visual Basic Editor.Object boxContains a drop-down list from which to select the desired object whose code you want to view in the Code window. If General appears in the Object box, all the code for the macros associated with the selected module appears in the Code window.Procedure boxContains a drop-down list from which to select a macro to display the macro’s code in the Code window.

Steps to Edit a Macro

To display the Visual Basic Editor:
  1. In the Code group on the Developer tab, click the Visual Basic button.
To edit a macro:
  1. Display the Visual Basic Editor.
  2. From the Tools menu, choose Macros.
  3. In the Macros dialog box, from the Macros In drop-down list, select the project containing the macro you want to edit.
  4. In the Macro Name list box, select the desired macro.
  5. Choose Edit.
  6. In the Code window, make the desired edits.
  7. Close the Macros dialog box.
To close the Visual Basic Editor:
  1. From the File menu, choose Close and Return to Microsoft Excel.

Also see how to record a Macro.

Deleting a Macro

If you no longer need a macro, you can delete it. Deleting unwanted macros makes it easier to view macros in the Code window in the Visual Basic Editor as well as view macros in the Macro dialog box.

You can delete a macro in an open workbook using the Macro dialog box or the Visual Basic Editor. If you want to delete a macro in the Personal Macro Workbook using the Macro dialog box, you must first unhide the Personal Macro Workbook. A benefit of using the Visual Basic Editor is that you can delete any macro in any open workbook or the Personal Macro Workbook, without unhiding it.

Sometimes when you receive an Excel workbook that contains VBA code you may want to remove the code to make the workbook macro-free. In other instances, you may be required to make your Excel workbook macro-free before sending it out to colleagues.

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:

  • Remove All Macros by Saving the File in XLSX format
  • Remove Specific Macros from the Macro dialog box
  • Remove the Module that has the Macro

Remove 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:

  1. Click the File tabClick on the File Tab
  2. Click on ‘Save As’ option (it’s ‘Save a Copy’ in new Excel versions)Click on Save a Copy
  3. Click on Browse. This will open the Save As dialog box.Click on Browse
  4. 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 wantEnter the name of the file from which you want to remove the macros
  5. Click on the Save As type drop-down
  6. Select the Excel Workbook (*.xlsx) optionSelect XLSX as the Save as Type
  7. Click on Save
  8. 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.Click on Yes in the VB Prompt

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

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:

  1. Click the Developer tab (in case you don’t see the Developer tab, see the note in yellow after the steps)Click on the Developer tab
  2. Click on the Macros button. This will open the Macro dialogue box where you can see all the macros in the workbookClick on Macros option
  3. In the ‘Macros in’ drop-down, make sure ‘This Workbook’ is selected.Select This Workbook in macros in option
  4. Select the macro name that you want to delete from the macro listSelect the macro to delete
  5. Click on the Delete button. This will delete that selected macroclick on the delete button to remove the 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.

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:

  1. Click on the Developer tab in the ribbonClick on the Developer tab
  2. Click on Visual Basic option (or use the keyboard shortcut – ALT + F11)Click on Visual basic button
  3. 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 ExplorerProject Explorer
  4. In the Project Explorer, double click on the object that has the macro code. This could be a module, a worksheet object, or ThisWorkbook.Double click on the module which has the code to delete
  5. 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.

How do I turn off VBA in Excel?

Change macro settings in the Trust Center.
Click the File tab..
Click Options..
Click Trust Center, and then click Trust Center Settings..
In the Trust Center, click Macro Settings..
Make the selections that you want, then click OK..

How do I stop VBA from running?

To break the running VBA program, do one of the following: On the Run menu, click Break. On the toolbar, click Break Macro icon. Press Ctrl + Break keys on the keyboard.

Will VBA be removed?

Microsoft said that it has no plan to remove VBA from the Windows version of Office.

Is Excel VBA necessary?

VBA is not only useful to individuals, but also to corporate users. Companies can use the VBA programming language to automate key business procedures and internal processes.