Skip to content
Blog/Excel
Excel

How to Create a Macro in Excel

Create an Excel macro to automate repeated formatting, cleanup, reporting, and data-entry steps without rebuilding the workflow by hand.

/5 min read

An Excel macro records or runs a set of actions so you can repeat them with one click. Use macros for recurring cleanup, formatting, report prep, and workbook setup tasks where the steps are predictable.

Macros are powerful, but they should automate a stable workflow. Do not start with VBA if the process still changes every week.

Turn on the Developer tab

Step 1. Go to File -> Options -> Customize Ribbon.

Step 2. Check Developer, then choose OK.

Step 3. Open the Developer tab and choose Record Macro.

Step 4. Give the macro a short name with no spaces, such as FormatWeeklyReport.

Step 5. Choose where to store it. Use This Workbook if the macro only belongs in the current file.

After recording starts, Excel captures many of your actions. Clean, deliberate steps matter.

Example: format a weekly restaurant expense report

Suppose a restaurant manager exports weekly expenses and needs the same setup before review: date formatting, currency formatting, filters, frozen headers, and column widths.

Record a macro that:

  1. Selects the expense table.
  2. Applies filters.
  3. Formats the Date column as a short date.
  4. Formats Amount as currency.
  5. Freezes the header row.
  6. Auto-fits the columns.
  7. Adds a bold title above the table.

The next week, the manager can paste the new export into an expense tracker for restaurants and run the macro instead of repeating the setup by hand.

When recording is enough

Recorded macros are best for visible worksheet actions: formatting, filtering, sorting, inserting columns, clearing old rows, and preparing reports.

They are weaker when the process needs decisions. If the macro needs to detect changing headers, skip bad rows, or combine files, you may need to edit the VBA or use Power Query instead.

Common macro mistakes

MistakeWhat happensFix
Recording random clicksMacro becomes fragilePlan the steps before recording
Using fixed cell referencesMacro breaks when data movesStart from tables or named ranges
Saving as .xlsxMacro is removedSave as .xlsm
Running untrusted macrosSecurity riskOnly enable macros from trusted files

WATCH OUT

Macros can contain executable code. Do not enable macros in files from unknown senders.

The Griddy way

Macros are useful, but deciding what to automate and what to leave manual is the hard part.

"Look at this weekly expense workbook and suggest a simple macro for formatting the report, freezing headers, adding filters, and preparing it for review"

Griddy can inspect the workflow, propose the repeatable steps, and help turn a messy recurring process into a safer spreadsheet routine.

Skip the manual work

Describe it. Griddy does it.

Instead of writing this formula yourself, just tell Griddy what you need in plain English. Works in Excel and Google Sheets.

Use this on real templates

Automate the recurring spreadsheet steps around templates

Macros are most useful when a team repeats the same cleanup, formatting, and report-prep steps before reviewing operating templates.

Finance