Excel VBA is not going away. Microsoft continues to support and maintain VBA as a core component of Excel, with no official plans to remove it, despite investing in newer automation tools like Power Query and Power Automate.
Background
Visual Basic for Applications (VBA) was introduced in 1993 with Excel 5.0 and quickly became the dominant language for automating repetitive tasks in Microsoft Office. Over three decades, it has been embedded in millions of corporate workflows, financial models, inventory trackers, and reporting systems. VBA’s longevity stems from its deep integration with Excel’s object model, allowing users to manipulate cells, charts, pivot tables, and even external databases with relative ease. Unlike newer tools that abstract away complexity, VBA gives granular control — a feature many legacy systems rely on.
How It Works
VBA runs inside Excel’s Integrated Development Environment (IDE), accessible via Alt+F11. Users write procedures (subroutines and functions) that interact directly with Excel’s objects: Workbooks, Worksheets, Ranges, and Cells. For example, a simple macro to auto-format a sales report might:
- Loop through each row in a data range
- Apply conditional formatting based on values
- Insert summary rows using formulas
- Save and close the file
These scripts are stored within the workbook as modules and can be triggered by buttons, keyboard shortcuts, or event handlers (like opening a file). Because VBA code is compiled into p-code and executed within Excel’s process, it runs faster than external scripts calling Excel via COM.
How to Choose
Deciding whether to use VBA today depends on your needs:
- Use VBA if you need fine-grained control over Excel’s UI, complex user forms, or integration with legacy systems that only expose COM interfaces.
- Use Power Query for data transformation tasks — it’s visual, reversible, and handles large datasets better than VBA loops.
- Use Power Automate (formerly Flow) if you need to trigger Excel actions from external services like Teams, SharePoint, or Outlook — without writing code.
- Use Excel’s built-in functions (LAMBDA, LET, dynamic arrays) for calculations that don’t require automation.
Many organizations now adopt a hybrid approach: Power Query cleans data, LAMBDA handles calculations, and VBA manages UI logic or legacy automation.
Common Problems
Despite its robustness, VBA has well-known pitfalls:
- Macro security warnings block execution on modern systems unless explicitly trusted
- Code breaks when worksheets are renamed, columns are moved, or data sources change
- Large VBA loops can freeze Excel — especially with 100,000+ rows
- Debugging is manual: breakpoints and the Immediate Window are the only tools
- Version compatibility issues arise when files move between Excel 2016, 365, and Mac versions
For example, a VBA script that references Worksheets("Sales") will crash if the sheet is renamed to "Sales Data" — a vulnerability rarely present in Power Query’s named sources.
Comparisons
VBA is often compared to newer tools, but they serve different purposes:
- VBA vs. Power Query: Power Query is for data shaping; VBA is for automation and interaction. Power Query can’t create a custom user form or respond to button clicks.
- VBA vs. Power Automate: Power Automate connects Excel to cloud services; VBA operates only within Excel. You can’t use Power Automate to modify cell colors based on conditional logic — VBA can.
- VBA vs. Python (xlwings): Python offers more power and libraries but requires external installation and is not embedded. xlwings bridges Python and Excel but adds complexity.
Microsoft’s official stance is clear: VBA is for advanced automation within Excel; Power Query and Power Automate are for modern, scalable data workflows.
Costs
VBA itself has no direct cost — it’s included with all licensed versions of Excel from 2007 onward. However, hidden costs include:
- Training time for users to maintain or debug macros
- Increased risk of errors: poorly written VBA can corrupt workbooks
- IT overhead: managing macro security policies across enterprise devices
- Migration costs if eventually replacing legacy VBA systems with modern tools
Unlike cloud-based tools with subscription fees, VBA’s cost is operational, not financial — making it a low-cost, high-risk option for critical systems.
Safety
VBA poses unique security risks:
- Macros can contain malicious code — viruses often spread via infected Excel files
- Malware like Emotet and IcedID have historically used VBA droppers
- Corporate environments often disable macros by default
- Only open files from trusted sources; enable macros only after verifying the sender and content
Microsoft mitigates this by defaulting to "Disable all macros with notification" in newer Excel versions. Users must manually enable content — a deliberate barrier to accidental execution. Always review VBA code in the IDE (Alt+F11) before enabling macros in unfamiliar files.
Alternatives
While VBA remains supported, alternatives are gaining traction:
- Power Query: Built into Excel since 2016. Handles data cleaning, blending, and refreshes without code.
- Power Automate: Automates workflows across Microsoft 365 apps — sends emails, updates SharePoint, triggers Excel actions remotely.
- LAMBDA and Dynamic Arrays: Excel 365 functions that replace many VBA calculation functions (e.g.,
=LAMBDA(x, x*2)creates reusable formulas). - Excel JavaScript API: For web-based Excel (Excel for the web), this enables add-ins using web standards — but it’s not available in desktop Excel.
- Python + pandas: For heavy data processing, exporting results to Excel — but requires external tools.
None of these fully replace VBA’s ability to control the Excel UI — which is why VBA persists.
Frequently Asked Questions
Will Excel stop supporting VBA in future versions?
No. Microsoft has repeatedly affirmed VBA’s continued support, including in Excel 365 updates released in 2023 and 2024. There are no public roadmaps or announcements indicating removal. VBA is embedded in the Excel binary — removing it would break millions of enterprise files.
Are new features being added to VBA?
Not significantly. Microsoft’s development focus has shifted to Power Query, Power Automate, and the JavaScript API. VBA receives only critical security patches and bug fixes. No new objects, functions, or syntax enhancements have been added in over a decade.
Can I use VBA in Excel for the web?
No. Excel for the web does not support VBA macros. Any workbook with VBA will open but disable execution. You must use the desktop app to run or edit VBA code.
Is VBA harder to learn than Power Query?
Yes. Power Query uses a visual interface with point-and-click transformations. VBA requires understanding programming concepts: variables, loops, error handling, and object models. A beginner can create a data transformation in Power Query in minutes; replicating it in VBA may take hours.
Do I need to learn VBA to be productive in Excel today?
No. Most users never need VBA. Basic Excel functions, pivot tables, and Power Query cover 95% of business needs. VBA is only essential for automating complex, repetitive UI tasks or maintaining legacy systems.
Can VBA code be converted to Power Query or Power Automate?
Partially. Data transformation logic in VBA can often be rebuilt in Power Query using its visual editor. UI automation (like clicking buttons or opening dialog boxes) cannot be replicated in Power Automate. Only the data-handling portions are portable.