Most Excel trainers tell you 'just switch to Excel Online for collaboration.' They’re wrong. If your workbook relies on VBA macros — even one tiny MsgBox or Worksheet_Change event — it will silently fail in Excel Online. No warning. No error. Just dead logic.
Quick Answer
No, VBA does not work in Excel Online — not at all. The Excel Online engine strips out all VBA code on upload, disables the Developer tab, and ignores .xlsm macro-enabled files as if they were plain .xlsx. Period.
All the Methods
| Method | Steps | Best For | Limitations |
|---|---|---|---|
| Power Automate + Excel REST API | 1. Store data in OneDrive/SharePoint 2. Trigger flow on file change 3. Use 'Get rows' → 'Apply to each' → 'Update row' | Automating reports, approvals, status updates | No real-time triggers; 5-min minimum poll delay |
| Office Scripts (TypeScript) | 1. Open Excel Online → Automate tab 2. Record or write script in Script Editor 3. Run or schedule via Power Automate | Data cleanup, formatting, batch edits | No user input (no prompts), no loops over >10k rows, no external API calls |
| Desktop fallback with AutoSave sync | 1. Keep master copy open in Excel Desktop 2. Enable AutoSave to OneDrive 3. Use VBA there; changes sync to Online instantly | Teams needing both VBA and cloud access | Requires at least one person running Desktop Excel 365 (not LTSC) |
| Excel JavaScript API (add-ins) | 1. Build manifest + JS code in VS Code 2. Deploy to AppSource or tenant catalog 3. Load in Excel Online via Insert → My Add-ins | Enterprise-scale automation with auth & UI | Requires dev resources; approval delays for internal deployment |
Method 1 Deep Dive
Office Scripts are the closest thing to VBA in Excel Online — but don’t assume syntax is similar. It’s TypeScript. No Range("A1").Value. You write worksheet.getRange("A1").values = [["Q3 Forecast"]];.
Here’s a real-world example: Sarah Chen at Acme Corp uses this script to standardize invoice entries. Her raw data sits in A1:C10:
| Vendor | Amount | Date |
|---|---|---|
| TechNova Ltd | $12,450.00 | 2024-03-15 |
| Nexus Logistics | $8,200.50 | 2024-03-18 |
| Veridian Systems | $3,999.99 | 2024-03-20 |
| Orion Labs | $21,100.00 | 2024-03-22 |
| Stellar Dynamics | $5,675.25 | 2024-03-25 |
Her Office Script (saved as "Format Invoices") does three things:
- Adds bold header row (A1:C1)
- Applies currency format to B2:B10
- Inserts today’s date in cell E1 as audit stamp
She runs it with Alt + A + R (Automate → Run). No pop-ups. No permissions dialog. And it works across browsers — even Edge on Windows 11 tablets.
Counterintuitive tip: Scripts execute *after* all formulas recalc. So if you have =SUM(B2:B10) in B12, and your script formats B2:B10, the sum won’t break — but if your script clears B2:B10 first, the formula result becomes zero *before* recalc. Always sequence operations: format → calculate → log.
Method 2 Deep Dive
Power Automate + Excel REST API is how global finance teams at companies like LumenEdge and Solara Group handle month-end reconciliations — without touching desktop Excel.
Scenario: Every time someone adds a row to the 'Payments' table in Excel Online (stored in SharePoint), the flow must:
- Check if Amount > $10,000
- If yes, email finance@lumenedge.com with row details
- Stamp column D with "Approved" or "Review Required"
The trigger is 'When a row is added or modified' (Excel Online Business connector). Then 'Get rows' pulls data from Sheet1!A2:D100. A 'Condition' checks item()?['Amount'] > 10000. If true, 'Send an email (V2)' fires with dynamic content: item()?['Vendor'], item()?['Amount'], item()?['Date'].
Key gotcha: Excel Online tables *must* be formatted as proper Excel Tables (Ctrl+T), not just ranges. If your data lives in A2:D50 with no table name, the 'Get rows' action returns nothing — even if cells look filled. Name it PaymentsTable in the Formulas tab → Name Manager.
This method runs fully server-side. No browser, no latency. And it works whether the user is on iOS, Chromebook, or Surface Go.
Cheat Sheet
| Task | How to Do It | Shortcut / ID |
|---|---|---|
| Open Script Editor | Excel Online → Automate tab → New Script | Alt + A + N |
| Run current script | In Script Editor → Run button (green triangle) | Alt + A + R |
| Find your scripts | Automate → My Scripts → click name | Alt + A + M |
| Trigger flow on edit | Power Automate → Create → Automated cloud flow → Excel Online (Business) → When a row is added or modified | — |
| Force desktop fallback | Right-click Excel Online tab → 'Open in Desktop App' | Alt + F4 (then reopen in Desktop) |
| Verify VBA removal | Upload .xlsm → go to File → Info → Check 'Related Documents' — no VBA projects listed | — |