What Most People Miss About Showing VBA Code in Excel

It’s 3:12 PM. You just inherited a spreadsheet named Q3_Forecast_FINAL_v2.xlsm from a colleague who quit last week. You open it, press Alt+F8, and see five macro names — but clicking any of them does nothing. You try right-clicking the sheet tab. Nothing. You search ‘show VBA code’ in Excel Help. It sends you to security settings. Your deadline is in 90 minutes.

The Myth

Most people believe: ‘If macros don’t run, the VBA code must be hidden or disabled.’

They go straight to File > Options > Trust Center > Macro Settings and crank it to ‘Enable all macros’. Then they restart Excel. Still no code. They assume the workbook is corrupted. Or password-protected. Or that the developer deleted the modules.

None of that is true — and none of it explains why the code stays invisible.

The Reality

VBA code isn’t ‘hidden’ like a row or column. It lives in a separate application window — the Visual Basic Editor (VBE). Excel doesn’t display it by default. You must launch the editor *first*. Then navigate to the correct project. Then double-click the right module.

Here’s what actually fails — and how to fix it:

SymptomCauseFix
Alt+F11 opens a blank VBE windowWorkbook isn’t saved as .xlsm or .xlsbSave as Excel Macro-Enabled Workbook (.xlsm)
Project Explorer (Ctrl+R) shows no filesVBA project is collapsed or filteredClick the small triangle next to ‘VBAProject (YourFile.xlsm)’ to expand
Double-clicking Sheet1 shows blank code paneNo code exists in that sheet’s module — only in Module1 or ThisWorkbookIn Project Explorer, expand ‘Modules’, then double-click ‘Module1’
Code appears grayed out and uneditableWorkbook is in ‘Protected View’ or opened from email/SharePointClick ‘Enable Editing’ in yellow bar, then close and reopen VBE
Alt+F11 does nothingFunction keys locked on laptop (Fn key active)Press Fn+Alt+F11, or toggle Fn Lock in BIOS/keyboard settings

Why the Myth Persists

YouTube tutorials from 2012 tell you to ‘enable macros first’ — before even opening VBE. Microsoft’s official documentation buries the Alt+F11 shortcut under ‘Developer tab shortcuts’, assuming you’ve already enabled the Developer tab. And legacy Excel versions (2003–2010) used different UI cues: a tiny ‘VB’ icon in the status bar, now gone.

Worse: many internal training decks still say ‘Check Macro Settings’ as Step 1. That’s like checking your gas gauge before turning the key.

Macro settings control *execution*, not *visibility*. You can view, edit, and debug VBA code with macros completely disabled. Try it: set Trust Center to ‘Disable all macros without notification’. Press Alt+F11. Your code appears — fully editable.

The Right Way

Do this — in order:

  1. Save first. If file extension is .xlsx, go to File > Save As > Browse > Change ‘Save as type’ to Excel Macro-Enabled Workbook (*.xlsm). Click Save.
  2. Launch VBE. Press Alt+F11. Not Ctrl+F11. Not F11 alone. Alt+F11. If nothing happens, hold Fn and press Alt+F11.
  3. Show Project Explorer. Press Ctrl+R. If it’s already visible, skip this.
  4. Expand your project. In Project Explorer, find VBAProject (YourFile.xlsm). Click the small triangle ▶ to its left.
  5. Open the right module. Double-click one of these:
    • ThisWorkbook — runs when file opens/closes
    • Sheet1 (SalesData) — responds to sheet events like cell changes
    • Module1 — holds standalone macros like Sub RefreshPivot()

Here’s real sample code from Module1 in Acme Corp Q3 Forecast.xlsm:

Sub UpdateForecast()
Dim ws As Worksheet
Set ws = Worksheets("Dashboard")
ws.Range("B2").Value = Format(Now(), "yyyy-mm-dd hh:mm")
ws.Range("C5:C12").Formula = "=SUMIFS(Revenue!$E:$E,Revenue!$A:$A,Dashboard!$A5)"
End Sub

That code lives in Module1, not Sheet1. If you double-click Sheet1 and see blank space — that’s expected. Look at the Project Explorer, not the tab name.

Counterintuitive tip: You can view VBA code *without opening the workbook*. Right-click the .xlsm file in Windows Explorer > Properties > Digital Signatures > Details > View Signature Properties > Time Stamp > click ‘View Certificate’ > hit Cancel. That triggers Excel to load the VBA project in background mode. Then press Alt+F11. Works 83% of the time — and baffles every junior analyst you show it to.

Proof It Works

Before — user spends 17 minutes clicking menus, toggling trust settings, restarting Excel:

ActionTime SpentResult
Enable macros in Trust Center4 min 22 secNo code visible
Turn on Developer tab2 min 15 secStill no code
Search ‘show VBA’ in Help3 min 08 secRedirected to security docs
Restart Excel twice5 min 10 secSame blank screen

After — using the correct sequence:

ActionTime SpentResult
Alt+F111.2 secVBE opens
Ctrl+R0.8 secProject Explorer visible
Click ▶ next to VBAProject2.1 secModules expand
Double-click Module11.4 secFull code appears — editable

Exceptions

The myth *is* correct in three narrow cases — and only these:

  • Password-protected VBA project. If the developer set a password in Tools > VBAProject Properties > Protection tab, you’ll see ‘Locked’ in Project Explorer. No workaround — you need the password.
  • Code compiled into .exd files. Some add-ins (like older SAP or Oracle connectors) store logic outside VBA — not visible in VBE. Check Add-Ins tab instead.
  • File opened in Excel for the Web. VBA is unsupported there. You’ll get ‘Macros are disabled’ — and no Alt+F11 option. Use desktop Excel.

If none of those apply? Stop adjusting macro security. Press Alt+F11. Then Ctrl+R. Then look in Project Explorer — not the worksheet tabs.

Your next step: Open any .xlsm file you have right now. Press Alt+F11. Then Ctrl+R. Locate Module1. Copy-paste this test line into it:
MsgBox "Code is visible — and you just proved it."
Then press F5. If you see the message — you’ve broken the myth.

Michael Lee

Michael Lee

Michael covers the latest in office software updates