How to Enable Macros in Excel

Safely enable macros to run VBA code while protecting your computer from malicious files

Security Warning - Read First!

⚠️ Only enable macros from trusted sources! Macros can contain malicious code that can harm your computer, steal data, or install viruses.

Best practice: Only enable macros in files from people/sources you trust completely, or macros you created yourself.

Quick Answer

Enable macros for one file: When you open a file with macros, click the Enable Content button in the yellow security warning bar.

Change macro settings: File → Options → Trust Center → Trust Center Settings → Macro Settings → Choose security level.

What are Macros?

Macros are automated sequences of commands written in VBA (Visual Basic for Applications) that perform repetitive tasks in Excel. They can:

✓ Legitimate Uses:

  • • Automate repetitive tasks
  • • Create custom functions
  • • Build interactive dashboards
  • • Process large datasets
  • • Generate reports automatically
  • • Import/export data

✗ Security Risks:

  • • Can delete files
  • • Access personal data
  • • Install malware
  • • Modify system settings
  • • Send emails without permission
  • • Spread to other files

Method 1: Enable Macros for One File (Safest)

This is the safest method - only enables macros for the specific file you trust.

Step-by-Step Instructions:

  1. 1.Open the Excel file containing macros
  2. 2.Look for a yellow security warning bar below the ribbon that says "SECURITY WARNING Macros have been disabled"
  3. 3.Click the Enable Content button on the right side of the warning bar
  4. 4.Macros are now enabled for this file (only for this session)

Note: You'll need to enable content each time you open the file unless you save it to a Trusted Location.

Best For:

  • Files from trusted colleagues or sources
  • One-time macro usage
  • Maintaining maximum security
  • Most recommended approach

Method 2: Change Macro Security Settings (Trust Center)

Adjust Excel's default macro security level for all files.

Step-by-Step Instructions:

  1. 1.Click FileOptions
  2. 2.Click Trust Center in the left sidebar
  3. 3.Click Trust Center Settings button
  4. 4.Click Macro Settings in the left sidebar
  5. 5.Choose one of the security levels (see options below)
  6. 6.Click OK → Click OK again
  7. 7.Restart Excel for changes to take effect

🔴 Disable all macros without notification

Macros won't run, no warning shown. Most secure but prevents all macro functionality.

🟡 Disable all macros with notification (Default/Recommended)

Shows security warning, lets you choose to enable. Best balance of security and usability.

🟠 Disable all macros except digitally signed macros

Only runs macros with valid digital signatures from trusted publishers. Good for corporate environments.

🔴 Enable all macros (NOT RECOMMENDED)

DANGEROUS! All macros run automatically without warning. Only use in completely isolated test environments.

⚠️ Never use this setting for regular work!

Recommendation: Keep the default "Disable all macros with notification" setting for maximum security.

Method 3: Add Trusted Locations (Best for Frequent Use)

Any files stored in Trusted Locations automatically have macros enabled without security warnings.

Step-by-Step Instructions:

  1. 1.File → Options → Trust Center → Trust Center Settings
  2. 2.Click Trusted Locations in the left sidebar
  3. 3.Click Add new location
  4. 4.Click Browse and select the folder where you store your macro files
  5. 5.Check "Subfolders of this location are also trusted" if needed
  6. 6.Click OKOKOK

Example Use Case:

Create a folder: C:\Users\YourName\Excel Macros\

Add it as a Trusted Location

All Excel files you save in that folder will have macros enabled automatically!

Security Warning: Only add folders you completely control. Never add Downloads, Desktop, or shared network drives as Trusted Locations!

Best For:

  • Your own macro files you create and maintain
  • Avoiding repetitive "Enable Content" clicks
  • Team folders with verified macro files
  • Development and testing environments

Macro-Enabled File Formats

Excel uses different file extensions to indicate macro capability:

ExtensionNameCan Contain Macros?
.xlsxExcel Workbook✗ No
.xlsmExcel Macro-Enabled Workbook✓ Yes
.xlsExcel 97-2003 Workbook✓ Yes (legacy)
.xlamExcel Add-in✓ Yes

Important: To save a file with macros, use File → Save As → Save as type: Excel Macro-Enabled Workbook (.xlsm)

Security Best Practices

Verify source: Only enable macros from files you trust completely (created by you or trusted colleagues)
Use antivirus: Keep antivirus software updated to scan macro-enabled files
Review code: Before enabling, press Alt+F11 to view macro code and check for suspicious commands
Keep default settings: Leave macro security at "Disable with notification" unless you have specific needs
Email attachments: Be especially cautious with macro files received via email
Regular backups: Back up important files before running macros from unknown sources
Test in isolated environment: Run untrusted macros on a test machine or virtual environment first

Common Issues & Solutions

No yellow security warning appears?

File might not contain macros, or macros are already enabled. Check if file extension is .xlsm

Enable Content button is greyed out?

File might be opened in Protected View. Click "Enable Editing" first, then "Enable Content"

Macros still won't run after enabling?

Check if macros exist (Alt+F11 → View modules). Verify macro security isn't set to "Disable all"

Can't save file with macros?

Must save as .xlsm format. Use File → Save As → change file type to "Excel Macro-Enabled Workbook"

Corporate policy blocks macro changes?

Contact your IT department. Group Policy settings may prevent users from changing macro security

Related Excel Tutorials

Create Safe, Powerful Macros

Generate clean, documented VBA code with our AI-powered macro generator

✓ No credit card required ✓ 5 free generations