Tech Reference

How to enable macros in Excel and automate your work on a spreadsheet

microsoft excel
There are several ways you can enable macros on Excel. Shutterstock
Updated
Read in app

Microsoft Excel spreadsheets can contain scripts known as macros. Macros are small, simple programs within Excel (or other Office programs) that can automate common tasks.

There was a time when macros were very common in Excel, but macro viruses — malicious macros that could inflict serious harm — forced Microsoft to implement safety and security precautions, including disabling macros by default.

These days, you can still use macros in Excel, but you need to enable the macro feature to do so. Here's how to enable (and disable) macros. 

How to enable macros in Excel

If you are willing to accept the risk of enabling all macros in Excel, you can permanently enable them using the Trust Center. 

1. Click "File" and then click "Options."

2. In the Excel Options window, click "Trust Center" in the navigation pane on the left. 

3. Click "Trust Center Settings…"

How_to_enable_macros_in_Excel 3
Open the Trust Center Settings to tweak the way Excel deals with macros.  Dave Johnson/Business Insider

4. In the navigation pane on the left, click "Macro Settings."

5. In the Macro Settings section, click "Enable all macros (not recommended: potentially dangerous code can run)" and then click "OK." As the option warns, this is a dangerous choice and not recommended. 

How_to_enable_macros_in_Excel 4
This window is where you can turn macros on and off in Excel.  Dave Johnson/Business Insider

If you want to disable macros in the future, return to the Trust Center and choose "Disable all macros with notifications." 

How to permanently enable a single macro in Excel

If you have an Excel file with a macro, you can easily enable it when you open the spreadsheet.

1. Open the file with the macro in Excel. 

2. You should see a yellow Security Warning message bar advising you that macros have been disabled. 

3. Click "Enable Content."

How_to_enable_macros_in_Excel 1
Click "Enable Content" to always allow this macro to run without being blocked.  Dave Johnson/Business Insider

How to enable a macro in Excel for one time only

If you want to run a particular macro just one time, you can configure Excel's security settings for that as well. 

1. Open the file with the macro in Excel. 

2. You should see a yellow Security Warning message bar advising you that macros have been disabled. 

3. Click "File" and then click "Info."

4. In the Security Warning section, click "Enable Content."

5. In the dropdown menu, click "Advanced Options."

How_to_enable_macros_in_Excel 2
To enable a macro, click "Advanced Options" under the "Enable Content" dropdown.  Dave Johnson/Business Insider

6. Click "Enable content for this session" and then click "OK."

The macro will be enabled for this one time and will be disabled the next time you open the file. 

Related coverage from Tech Reference:

Read next

Dave Johnson is a technology journalist who writes about consumer tech and how the industry is transforming the speculative world of science fiction into modern-day real life. Dave grew up in New Jersey before entering the Air Force to operate satellites, teach space operations, and do space launch planning. He then spent eight years as a content lead on the Windows team at Microsoft. As a photographer, Dave has photographed wolves in their natural environment; he's also a scuba instructor and co-host of several podcasts. Dave is the author of more than two dozen books and has contributed to many sites and publications including CNET, Forbes, PC World, How To Geek, and Insider.