New Tool Radar

AI for Data & Spreadsheets

How to Check the Steps a Recorded Macro Will Replay Before Running It

Check the steps a recorded macro will replay before running it on live data, so a stray click does not rewrite the wrong cells.

Schematic with three steps: Open the macro in the script editor; Run it on a copy of the; Fix or re-record the wrong steps.

A macro records a series of clicks and keystrokes and replays them exactly, including the cells that were selected when it was recorded. An AI assistant that suggests recording a macro, or hands over a recorded one, may have captured a wrong selection, a sort on the wrong column, or a delete the reader did not intend. Read the recorded steps in the script editor before running the macro on real data.

What you need

  • The recorded macro and the sheet it will run on
  • A copy of the data to test the macro on
  • The result the macro should produce

Step 1: Open the macro in the script editor

In Google Sheets, open Extensions, Macros, Manage macros, and choose Edit macro; in Excel, open the Visual Basic editor and read the recorded sub. Read each step in order and write down which cells it touches.

Step 2: Run it on a copy of the data first

Make a copy of the sheet, run the macro there, and check the result against the expected outcome. A macro that selects a fixed range will act on the same cells even when the data has moved.

Step 3: Fix or re-record the wrong steps

If a step touches the wrong cells, edit the step in the editor or re-record the macro with the correct selection. Run the fixed macro on the copy again before using it on the live sheet.

Worked example: synthetic header-formatting macro

The table below is a synthetic example. It shows the expected result of checking a recorded macro; no formula was run.

Check Value Result
Macro recorded to Bold row 1 Header row
Step found in the code Selects A1:F1 Correct range
Wrong step found Deletes column G Stray delete recorded
Result after removing the step Header bolded Column G kept

Expected result (UNTESTED). the recorded macro bolds the header row A1:F1 as intended, but it also deletes column G, a stray step from the recording; removing that step keeps column G and still bolds the header. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A recorded macro replays fixed cell addresses, so it acts on the same cells even after the data moves.
  • A macro can only have a keyboard shortcut if one was assigned, and a sheet can have at most ten macros with shortcuts.
  • Macros live in scripts bound to one spreadsheet and cannot be used from a standalone script or an add-on.
  • A macro that changes one cell can be applied to a range by selecting the range first, which is often easier than recording a new macro.

Sources

See all