Excel’s macro recorder creates VBA macros that work in desktop Excel for Windows and Mac, but compatibility is not guaranteed between platforms or with Excel for the web. A recorded macro is most reliable when it uses ordinary worksheet operations; Windows-only features, file paths, controls, and add-ins can prevent it from working elsewhere.
What macro recorder compatibility means
“Compatible” can refer to several different things: whether Excel can store a macro, whether a particular Excel edition can run it, and whether it produces the same result on another computer. These are separate questions. A workbook can contain a macro that another version of Excel can open but cannot execute, or a macro can run without errors while producing a different result because a referenced range or setting differs.
The recorder does not create a self-contained automation file. It translates supported actions in Excel into Visual Basic for Applications (VBA) code and stores that code in the workbook or in a personal macro workbook. The destination Excel program must support VBA, the code must be allowed to run, and any objects or features the code relies on must be available.
For example, a macro that applies a number format to a specified range is usually much easier to move between computers than one that controls a Windows dialog, calls a Windows system library, or depends on an add-in installed only on the original computer.
Excel versions and platforms
In Microsoft 365 desktop Excel for Windows, the recorder writes VBA that can generally be used in other desktop Excel versions that support the same VBA statements and Excel object-model features. The same basic principle applies to desktop Excel for Mac. However, the fact that both platforms support VBA does not mean every recorded macro is cross-platform: Windows and Mac differ in operating-system access, file handling, available controls, and some application features.
Excel for the web is a more significant boundary. It can open and edit many workbooks containing VBA, and the VBA project can remain in the file, but Excel for the web cannot create, edit, or run VBA macros. A macro recorded in desktop Excel therefore needs desktop Excel to run. Office Scripts are a separate web-oriented automation feature; they use a different technology and are not an automatic conversion of recorded VBA.
- Excel for Windows: Records and runs VBA, subject to security settings and the macro’s dependencies.
- Excel for Mac: Records and runs VBA, but Windows-specific code and components may not work.
- Excel for the web: Can work with many macro-enabled workbooks, but does not run VBA.
When distributing a workbook, identify the exact target environment. “Excel” alone is not enough: a recipient using a browser, a Mac, or a managed corporate installation may not have the same capabilities or permissions as the person who recorded the macro.
What the recorder captures—and what it does not
The recorder is designed to turn supported Excel commands into VBA. It can capture many routine tasks, such as entering values, applying formats, sorting data, changing page setup, and working with cells or ranges. The recorded code often reflects the sequence of interface actions rather than the broader intention behind them. It may refer to the currently selected cell, activate a sheet, or select a range before carrying out the main operation.
That can make a recorded macro dependent on its starting state. If it assumes a particular sheet is active, or that the cursor begins in a certain cell, running it from another location can lead to an error or affect the wrong cells. Recording is a useful way to learn the VBA syntax for an operation, but the generated code may need editing before it is robust or easy to share.
The recorder also does not capture every possible action. Some Excel features and interactions are not represented as recordable VBA commands, and actions outside Excel—such as choosing options in unrelated programs—are not turned into a portable Excel macro. It records supported Excel operations, not a general recording of everything on the screen.
On Windows, start recording from Developer > Code > Record Macro. The recorder dialog lets you name the macro, choose where to store it, and optionally assign a shortcut. On Mac, use Developer > Record Macro. The precise ribbon layout can vary by edition, but the macro created is VBA rather than a video or replay file.
Why recorded macros fail on another computer
Most compatibility problems come from assumptions in the macro or its environment, not from the act of recording. A macro may work perfectly on its author’s computer because the required workbook, folder, add-in, or control is present there. A recipient who lacks that dependency may see an error, a missing component, or a macro that runs only partway.
- Windows-only code: Calls to Windows APIs, COM automation, or Windows-specific libraries are not generally portable to Mac. Some VBA references and controls available on Windows are absent on Mac.
- Hard-coded file locations: A path such as a particular user’s Documents folder may not exist for another person. Windows and Mac also use different path conventions.
- Fixed selections: Recorded code may refer to a specific row, column, or active cell. New data or a different starting position can make those references unsuitable.
- Missing references or add-ins: Code that depends on an installed library or add-in may fail when that dependency is not installed or enabled.
- Different workbook structure: Renamed sheets, changed table names, protected sheets, or a different column layout can invalidate assumptions in the code.
- Security restrictions: Excel may block macros or show a warning, especially for files obtained from the internet or received through email.
For instance, a recorded macro that formats cells on “Sheet1” may stop working if a colleague renames that sheet. A macro that formats the current selection may still run, but format a different range than intended. These are different failures: one is a broken reference, while the other is a valid action applied to the wrong target.
Workbook formats and where macros are stored
A macro-enabled workbook must be saved in a format that preserves VBA. For a typical workbook, use Excel Macro-Enabled Workbook (*.xlsm). Excel Binary Workbook (*.xlsb) can also store VBA. The standard .xlsx format does not preserve VBA code; if a workbook with macros is saved as .xlsx, Excel warns that the macro project will be removed if the user continues in that format.
The macro’s storage location affects who can use it. When recording, “This Workbook” stores the code in the current workbook, making it available when that file is opened in desktop Excel. “Personal Macro Workbook” stores macros in a personal file that loads for that user, which is convenient for personal workflows but is not automatically included when the workbook is sent to someone else. A macro stored in another workbook is likewise not bundled just because a different workbook is shared.
Before sending a file, check its extension and storage choice. A recipient may be able to open an .xlsm file in Excel for the web, for example, but still need desktop Excel to run its VBA. Changing the extension by renaming the file does not convert its contents or make an unsupported format macro-enabled.
How to make a recorded macro more portable
Start by recording the smallest useful task, then inspect and refine the generated code in the Visual Basic Editor. Remove unnecessary selecting and activating where practical, and refer directly to the intended workbook, worksheet, and range. This reduces dependence on which cell happens to be selected when the macro starts.
Before sharing a macro, work through these checks:
- Decide the target platform. If recipients use both Windows and Mac, avoid Windows-only APIs, controls, and dependencies, or provide separate implementations.
- Use stable references. Prefer clearly identified worksheets, tables, and ranges over assumptions about the active sheet or selection.
- Review external dependencies. List required add-ins, reference libraries, source files, and permissions. Do not assume another user has the same setup.
- Test a copy in the target environment. Test with representative data and the expected workbook structure, not only on the computer where the macro was recorded.
- Explain how to run it. Tell users which desktop Excel platform is supported, what the macro changes, and what input or workbook layout it expects.
Macros cannot be undone with Ctrl+Z. Save a copy of the workbook before running a macro, especially while testing or when its effects include deleting, moving, or overwriting data. A macro that works on a sample file is safer to evaluate than one run first on the only copy of an important workbook.
Macro security and access
Compatibility does not override macro security. Excel’s security controls can prevent VBA from running even when the code and workbook format are otherwise compatible. Organizational policies may restrict macro execution, and Office can block VBA in files identified as coming from the internet. Users should follow their organization’s rules rather than lowering security settings broadly to make one file run.
Only enable macros when the source is trusted and the purpose is understood. A macro can change or delete workbook data and, depending on its code and environment, perform actions beyond simple formatting. If a file unexpectedly asks the reader to enable content, verify who sent it and why the macro is needed. A trusted location or a digitally signed macro may be appropriate in managed workflows, but neither is a reason to trust unknown code automatically.
When to use another automation method
If everyone who needs the automation uses desktop Excel and the task is well suited to VBA, a recorded macro can be a practical starting point. It is particularly useful for repetitive operations that are already available as Excel commands. For a process shared across Windows, Mac, and browser users, first check whether VBA’s platform limits fit the requirement.
Office Scripts may suit browser-based workflows in supported Microsoft 365 environments, but they are not VBA and do not run by simply opening an .xlsm file. Power Automate can coordinate some cloud workflows, while formulas, tables, and built-in Excel features may eliminate the need for a macro altogether. The right option depends on where the work happens, what systems it must connect to, and who will maintain it.
Frequently Asked Questions
Can an Excel macro recorded on Windows run on a Mac?
Sometimes. VBA code using common Excel worksheet operations may work on both, but Windows-specific APIs, controls, references, and file assumptions can break on Mac. Test the macro on the actual target platform.
Can I run a recorded macro in Excel for the web?
No. Excel for the web can open many macro-enabled workbooks, but it cannot run VBA. Open the workbook in desktop Excel to run the macro, or consider a separate web-compatible automation approach such as Office Scripts where available.
Does an .xlsx file keep a recorded macro?
No. The .xlsx format does not store VBA code. Save the workbook as .xlsm or .xlsb if it needs to retain a macro, and heed Excel’s warning when changing formats.
Why does a macro work for me but not for a colleague?
Check that the colleague has a desktop Excel version that supports VBA, that macros are permitted, and that the workbook’s sheets, ranges, references, add-ins, and file locations match what the code expects.
Is the macro recorder the same on Windows and Mac?
Both desktop platforms provide a VBA macro recorder, but their Excel features and operating-system integrations are not identical. The resulting code may need platform-specific adjustments even when the recorded Excel actions look similar.
Related
- Conditional Formatting Multiple Cells in Excel: Rules
- Hide Columns Based on Cell Values in Excel Automatically
- Conditional Formatting for Absolute Values in Excel
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Excel VBA Switch Case: Select Case Syntax and ExamplesExcel VBA does not have a switch-case statement named Switch; its equivalent is Select Case. Use it to…
- Macro Recorder in Excel: What It Can and Cannot DoExcel’s Macro Recorder turns many actions in the desktop app into VBA code that you can run again.…
- VBA Dictionary: How to Read Key-Value Pairs in ExcelIn VBA, read a Scripting.Dictionary pair by using its key to retrieve the value, as in dict(key), or…
- Macro Recorder for Windows: Options and How to ChooseA macro recorder for Windows captures repeated actions and replays them, but Windows does not provide one universal…
- Excel Range Find VBA: Search Cells ReliablyIn Excel VBA, use the Range.Find method to search a specified range; check whether it returned a cell…
- Excel VBA: Check If a String Contains a Substring in a CellIn Excel VBA, use InStr to check whether one string contains another: it returns a position greater than…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.