Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Is VBA Still Supported in Excel? Current Status & Options

· 6 min read · Home Tech

In this article
  1. Understanding VBA in the Modern Excel Ecosystem
  2. How VBA Works and How to Access It
  3. Common Problems and Security Risks
  4. Comparing VBA with Office Scripts and Power Query
  5. Safety and Best Practices for VBA Development
  6. Frequently Asked Questions

Yes, VBA (Visual Basic for Applications) is still fully supported in the desktop versions of Microsoft Excel. While Microsoft has introduced newer automation tools, VBA remains a core component of the Excel ecosystem for users who need to automate complex tasks, create custom functions, and manage large-scale data processing within the application.

Understanding VBA in the Modern Excel Ecosystem

VBA is an event-driven programming language developed by Microsoft that is embedded directly into most Microsoft Office applications. In Excel, it allows users to write macros—sequences of instructions that automate repetitive tasks—and create UserForms for custom data entry. Because VBA has been the industry standard for decades, millions of legacy spreadsheets in finance, engineering, and logistics rely on it to function.

It is important to distinguish between the different versions of Excel, as support varies by platform. VBA is supported on Excel for Windows and Excel for Mac. However, it is not supported on Excel for the Web (the browser version) or the mobile apps for iOS and Android. If you open a workbook containing VBA macros in a web browser, the macros will not run, although the data and formulas will remain intact. To execute the code, you must open the file in the desktop application.

How VBA Works and How to Access It

VBA operates through the Visual Basic Editor (VBE), a separate window that allows you to write, edit, and debug your code. The VBE is not visible by default in a fresh installation of Excel to prevent accidental changes by novice users. To access the tools necessary for VBA, you typically need to enable the Developer tab.

To enable the Developer tab, follow these general steps (labels may differ slightly by version or region):

  1. Right-click any existing tab on the Ribbon (such as Home or Insert).
  2. Select Customize the Ribbon.
  3. In the right-hand list of Main Tabs, check the box next to Developer.
  4. Click OK.

Once the Developer tab is active, you can access the Visual Basic editor via the Visual Basic button or by using the keyboard shortcut Alt + F11. Within the editor, you create "Modules," which are the containers where your subroutines (Subs) and functions (Functions) are written. A Sub performs an action, such as formatting a report, while a Function returns a value, allowing you to create custom formulas that can be used directly in a cell.

Common Problems and Security Risks

One of the most common hurdles for VBA users is the "Blocked Macro" security warning. Because VBA code can potentially execute malicious commands on a computer—such as deleting files or accessing system registries—Microsoft has implemented strict security protocols. By default, Excel disables macros in files downloaded from the internet.

When a user opens a macro-enabled workbook (.xlsm), they often see a yellow security warning bar. If the file is flagged as coming from an untrusted source, Microsoft may block the macros entirely, requiring the user to manually unblock the file in the Windows File Properties menu before it can be run. This is a critical safety feature designed to prevent ransomware and other malware from spreading through spreadsheet attachments.

Other common technical problems include:

  • Version Incompatibility: While VBA is generally backward compatible, code written for a very old version of Excel may occasionally fail if it references a library or object that has been deprecated.
  • Reference Errors: If a macro relies on an external library (like a specific database connector) that is not installed on another user's machine, the code will trigger a "Missing Reference" error.
  • Performance Lag: Poorly written VBA code, such as loops that constantly select and activate cells, can cause Excel to freeze or crash when processing large datasets.

Comparing VBA with Office Scripts and Power Query

While VBA is still supported, Microsoft has introduced newer alternatives that address its limitations, particularly regarding cloud compatibility and security. The two most prominent alternatives are Office Scripts and Power Query.

Office Scripts is the modern successor to VBA for the cloud era. It uses TypeScript (a superset of JavaScript) and is designed specifically to work across Excel for the Web and the desktop version. Unlike VBA, Office Scripts are stored in the cloud rather than within the workbook file, making them easier to manage across an organization and allowing them to be triggered by Power Automate flows (e.g., automatically running a script when an email arrives).

Power Query, on the other hand, is not a programming language but a data transformation engine. For many users, Power Query replaces the need for VBA entirely. Where a VBA macro might be used to clean data, remove duplicates, and merge tables, Power Query can do this through a visual interface with a recorded set of steps. This is generally more stable and easier to maintain than custom code.

Choosing between them depends on the goal:

  • Use VBA for complex application control, creating custom user forms, or automating tasks that involve other desktop apps (like sending an email via Outlook).
  • Use Office Scripts for automation that must work in a web browser or integrate with the Microsoft 365 cloud ecosystem.
  • Use Power Query for importing, cleaning, and reshaping data from external sources.

Safety and Best Practices for VBA Development

To maintain a stable and secure environment, developers should follow specific safety guidelines. First, never run a macro from an untrusted source. If you receive a file from an unknown sender that requires macros to be enabled, it is a significant security risk.

For those writing their own code, implementing error handling is essential. Without it, a single unexpected value in a cell can cause the entire macro to crash, leaving the user with a confusing debug window. Using the "On Error GoTo" statement allows the developer to redirect the code to a specific error-handling block that can provide a user-friendly message instead of a system crash.

Additionally, to optimize performance, developers should avoid using .Select and .Activate commands. For example, instead of selecting a cell and then changing its value, it is more efficient to reference the cell directly in the code. This reduces the overhead on the Excel engine and prevents the screen from flickering during execution.

Frequently Asked Questions

Will Microsoft remove VBA in the future?

Microsoft has not announced a date for the removal of VBA. Given the massive amount of enterprise infrastructure that relies on VBA macros, removing it would cause significant disruption to global business operations. While they are promoting newer tools like Office Scripts, VBA remains a supported feature of the desktop applications.

Can I run VBA macros on an iPad or Android tablet?

No, VBA is not supported on mobile versions of Excel. If you need automation on a mobile device, you should look into Office Scripts, which are designed for the web-based and cloud-connected versions of the software.

What is the difference between .xlsx and .xlsm files?

An .xlsx file is a standard workbook that cannot contain macros. An .xlsm file is a macro-enabled workbook. If you write VBA code in a workbook and save it as an .xlsx file, all of your code will be permanently deleted upon saving.

Why is my VBA code running so slowly?

The most common cause of slow VBA performance is the constant updating of the user interface. You can significantly speed up your macros by adding "Application.ScreenUpdating = False" at the start of your code and setting it back to True at the end. This stops Excel from redrawing the screen after every single change.

Does VBA work the same on Mac and Windows?

Mostly, but not entirely. While the core language is the same, some specific commands—particularly those that interact with the Windows operating system, such as file system paths or API calls—will not work on macOS. Mac users may find that certain ActiveX controls are also unsupported.