Excel VBA Now: What Still Works and What Doesn’t in 2026

VBA & macros · Updated November 3, 2026

Excel VBA Now: What Still Works and What Doesn't in 2026

Yes—Excel VBA is still supported in the desktop versions of Excel for Microsoft 365, and it remains useful for automating workbook tasks. It does not run in Excel for the web, however, so a macro-enabled workbook that needs to run in a browser may call for Office Scripts or another approach.

What “Excel VBA now” means

VBA, short for Visual Basic for Applications, is Excel’s built-in programming language for desktop macros. It lets a person automate actions, respond to workbook events, and work with Excel objects such as worksheets, ranges, charts, and tables. Microsoft 365 updates have not removed VBA from desktop Excel; people still use it to maintain established workbooks and build desktop-based automation.

The important distinction is where the workbook is opened. Excel for Windows and Excel for Mac can run VBA, although their capabilities are not identical. Excel for the web can open many macro-enabled workbooks, but it cannot create, edit, or run VBA macros. A workbook’s data and formatting may still be available in the browser, but its VBA automation will not execute there. “VBA still works” therefore means it works in a compatible desktop app, not everywhere Excel is available.

Where VBA works today

On Windows, VBA is available in the desktop Excel app. A workbook containing VBA is commonly saved as an Excel Macro-Enabled Workbook (.xlsm). The Excel Binary Workbook (.xlsb) format can also contain macros. An ordinary .xlsx file does not preserve VBA code: saving a macro-enabled workbook as .xlsx prompts you that the macro project will be removed if you continue.

Excel for Mac also supports VBA, so a macro can be a practical choice for workbooks used on both desktop platforms. But compatibility is not guaranteed just because both versions have a VBA editor. Code that calls Windows-specific components, such as certain Windows API functions, COM automation, or ActiveX controls, may fail on a Mac. File access and some integrations can differ as well. If a workbook must run on both platforms, test it in each one and avoid platform-specific dependencies where possible.

In Excel for the web, VBA is not a browser automation option. Opening the file in the web app does not convert the VBA into a web script. If browser-based use is essential, decide how the tasks will be handled there before relying on a macro to produce required results.

VBA and Office Scripts: what is the difference?

Office Scripts is Microsoft’s scripting option for automating tasks in supported versions of Excel for the web and some Microsoft 365 desktop experiences. It uses TypeScript rather than VBA and is designed around workbooks in the Microsoft 365 environment. Availability depends on the account, subscription, organization settings, and Excel version, so a missing Automate tab may be an access or policy issue rather than a broken workbook.

VBA is often a better fit when the automation already exists in desktop Excel, relies on workbook events, uses a user form, or interacts with desktop features and other applications. Office Scripts is worth considering when a task needs to run in a browser or as part of a cloud workflow. Their capabilities and execution environments differ; Office Scripts is not simply VBA with a new name, and VBA code cannot be pasted into an Office Script and expected to work.

  • Choose VBA when a desktop workbook needs repeatable automation or has a substantial existing macro project.
  • Consider Office Scripts when users work in the browser and the needed actions are supported in that environment.
  • For a process shared across people, check account access, organizational permissions, and how the script or macro will be distributed before committing to either tool.

How to create and run a simple macro

In Excel for Microsoft 365 on Windows, show the Developer tab by selecting File > Options > Customize Ribbon, checking Developer in the main tabs list, and selecting OK. On a Mac, open Excel > Settings > Ribbon & Toolbar and enable Developer; wording can vary slightly by release. In desktop Excel, choose Developer > Visual Basic to open the editor. Alt+F11 is the Windows shortcut. On Mac, Option+F11 may open the editor; some keyboards require Fn as well. You can use the ribbon command if the shortcut differs on your keyboard.

  1. Save a copy of the workbook before running unfamiliar VBA. Macros cannot be undone with Ctrl+Z on Windows or Command+Z on Mac.
  2. Save the working file as .xlsm if it needs to retain VBA.
  3. Open the Visual Basic Editor, choose Insert > Module, and put the code in the new module.
  4. Change the example sheet name if needed, then run it from the editor or return to Excel and select Developer > Macros.

This example writes the current date and time into cell B1 on a worksheet named Report. It replaces the existing value in that cell, so use it only in a workbook where that is intended.

Sub AddReportTimestamp()
    ' Write the current time to the Report sheet.
    Dim ws As Worksheet

    Set ws = ThisWorkbook.Worksheets("Report")
    ws.Range("B1").Value = Now
    ws.Range("B1").NumberFormat = "yyyy-mm-dd hh:mm"
End Sub

The code assumes the workbook contains a worksheet named Report. If it does not, VBA will return an error when it tries to find that sheet. A macro does exactly what its instructions say, not what a user intended, which is why a backup and a quick review of any code matter.

Tasks VBA is still good at

VBA is especially useful when a process is repeated inside a desktop workbook and the steps are stable. For example, a macro can clear input cells, copy a prepared report to a new worksheet, apply formatting, or check rows for missing entries. It can also respond to events, such as running code when a workbook opens or when a particular cell changes. Event-driven macros need extra care because they may run without the user explicitly choosing a Run button.

Another strength is its ability to control many Excel objects. A short macro can loop through worksheets, inspect a range, or apply the same change to multiple files. This can reduce repetitive manual actions, but automation should include checks for the expected sheet names, columns, and input data. If a process changes frequently, a rigid macro may become more work to maintain than the manual task it replaced.

VBA is also commonly used to support older workbooks. Organizations may have years of templates, reporting tools, and procedures built around macros. Replacing them can require redesigning the workflow, validating results, retraining users, and confirming that dependent systems still work. Continued desktop support makes it possible to maintain such tools, but it does not remove the need to assess their reliability and security.

Limitations and compatibility to plan for

VBA code is stored in a workbook or add-in, but its success can depend on more than the file itself. It may rely on a specific sheet name, a particular folder structure, a reference to an installed library, or a component available only on Windows. If code uses an external library, another computer may report a missing reference or fail to run even though the workbook opens.

Excel’s interface and automation model also change over time. A macro that selects cells by position can break when someone inserts a column or renames a sheet. Code that depends on a particular dialog, add-in, or external application may be especially fragile. Prefer clear references to named worksheets and ranges, validate inputs, and document assumptions such as required file locations and supported platforms.

VBA is not a formula replacement for every calculation. A normal Excel formula recalculates as workbook data changes and is visible in the grid; a macro runs instructions and may change cells or workbook structure. For a simple calculation, formulas are usually easier to inspect and share. For repeated multi-step actions, VBA may be more appropriate. Excel for the web’s inability to run VBA is a decisive limitation if users must execute the automation in a browser.

Macro security and safe use

Macros can change or delete workbook content and may interact with files or other applications, so treat code as executable software. A file from an unknown sender should not be made trusted just because Excel displays a prompt or because the workbook looks familiar. On Windows, Office may block macros in files identified as coming from the internet. Security settings and organizational policies can affect what happens, and a work or school administrator may control those settings.

  • Use macros only from a source you trust, and ask the sender what the code is meant to do if that is unclear.
  • Keep a separate copy of important data before running a macro. Ctrl+Z does not reverse the macro’s changes.
  • Do not set Excel to enable all macros as a routine workaround. Use the security options approved for your device or organization.
  • If you maintain code for others, explain its purpose and required workbook structure, and consider signing it with an appropriate digital certificate under your organization’s policy.

Signing a macro can help users identify code from a publisher they trust, but a signature is not proof that the code is harmless. A signed macro can still contain errors or do something unexpected. Users should consider both who supplied it and what it does.

Common problems and practical checks

If a macro does not appear in the macro list, first check that the workbook is open in desktop Excel and saved in a macro-capable format. Check that the procedure is a public macro in a standard module, rather than code placed only in a worksheet or workbook object. If Excel blocks it, follow your organization’s approved security process instead of changing broad security settings or trusting an unknown file.

If a macro starts but stops with an error, read the highlighted line and check the assumptions behind it. Frequent causes include a misspelled worksheet name, a missing file, an unexpected blank cell, or a reference to a component that is not installed. If code works on Windows but not Mac, inspect it for Windows-only controls, API calls, or external automation. If it fails only in the browser, that is expected for VBA: run it in desktop Excel or redesign the workflow for a web-compatible tool.

When testing changes, use a copy of the workbook and small, representative sample data. Test both the normal case and likely exceptions—for example, a missing sheet, an empty input range, or a file that is already open. A macro that works once with ideal data is not necessarily robust enough for routine use.

How to choose the right approach

Start with where the people who use the workbook will work. If they all use compatible desktop Excel and the automation is workbook-centered, VBA may be the direct and maintainable option. If the workbook must be used in a browser, identify which actions can be done manually there and whether Office Scripts or a cloud workflow can cover the rest. If users need both desktop and web access, a hybrid process may be necessary, but it should be clearly documented so nobody assumes a VBA button works online.

Next, compare the cost of maintaining the automation with the benefit it provides. Consider how often the task occurs, how many errors manual repetition causes, who can support the code, and how sensitive the workbook is to platform or layout changes. A small one-off task may not justify a macro. A mature desktop reporting process may justify keeping VBA while documenting it and testing it after workbook changes. The best choice is the one that fits users’ actual Excel environment and can be supported safely.

Frequently Asked Questions

Is VBA being removed from Excel?
VBA remains available in desktop Excel for Microsoft 365. Excel for the web does not run VBA, which is a platform limitation rather than evidence that desktop VBA has disappeared.

Can I run an Excel VBA macro online?
No. Excel for the web cannot run, create, or edit VBA macros. Open the workbook in desktop Excel to run its VBA, or investigate a web-compatible alternative such as Office Scripts where available.

Does Excel for Mac support VBA?
Yes. Excel for Mac includes VBA support, but some code that relies on Windows-only features may not work. Test the actual workbook on Mac if it must be shared across platforms.

Will a macro work if I save the workbook as .xlsx?
No. The .xlsx format does not retain VBA code. Save a workbook that needs its macros in a macro-enabled format such as .xlsm, or use .xlsb if that format suits your workflow.

Is VBA better than Office Scripts?
Neither is universally better. VBA suits many desktop-based automations and existing macro workbooks; Office Scripts is designed for supported Microsoft 365 web and cloud workflows. Choose based on where the workbook runs and what the automation needs to do.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.