TL;DR: A macro in Excel is a recorded or programmed sequence of actions that Excel replays for you. It is stored as VBA code inside the workbook, and it can do anything a person clicking around can do — format cells, build sheets, run calculations, generate reports. The practical point is not the recording feature; it is that a macro turns a repeated fifteen-minute task into a single keystroke.
What happens when you record one
The recorder does not learn your intent. It watches your clicks and writes down each one as a line of VBA, in order, with whatever cell references were active at that moment.
That has a consequence people discover the hard way: a recorded macro that formats “A1:C10” will always format A1:C10, even when the data has grown to forty rows. The recorder captures exact addresses, not relative intent.
Recording is therefore best used as a first draft. It gives you working code that you then edit — replacing fixed references with dynamic ones — rather than a finished tool.
Where macros live
This is the part most people get wrong, and it explains the “my macro disappeared” complaint.
By default, macros are saved inside the workbook that is open. If you save as a normal .xlsx file, Excel warns you that macro content cannot be kept, and the macros are discarded. To keep them you must save as .xlsm — the macro-enabled format.
The alternative is the Personal Macro Workbook, a hidden file that opens with Excel every time. Macros recorded there are available in every workbook on that machine, which is what you want for utility macros you use constantly. They live only on that computer, which is what you want to know before you rely on them elsewhere.
A third location is an add-in file, which is how macros get distributed to a team. That is a deployment decision rather than a personal one.
What VBA actually is
VBA is the programming language underneath every Excel macro. It is old, verbose, and not installed by default on macOS, but it is capable and it is the only way to automate Excel natively.
The structure is simple. Every macro is a subroutine — a named block of statements — and each statement does one thing to one object. The Object is what you act on (a range, a worksheet, the workbook). The Method is what you do to it. The Property is what you set.
So Range("A1").Value = 5 acts on the range object, using the value property. And ActiveSheet.Range("A1:C3").Interior.Color = RGB(255,0,0) sets the fill of a range. The pattern is consistent, which is why reading unfamiliar VBA is easier than reading unfamiliar code in most languages.
Reading the four things worth understanding
You do not need to learn VBA properly to be effective with macros. Four concepts cover most real work.
Variables. Named containers. Dim lastRow As Long creates one, and giving it a type matters because a Variant (untyped) is much slower on large loops.
Loops. For Each over a range of cells is the workhorse. It is also where a badly written macro becomes visibly slow, so recording a loop and then tidying it is a common first edit.
Conditionals. If ... Then ... End If. This is what lets a macro skip a blank row or handle a different format without a second macro.
Turning off screen updates. Application.ScreenUpdating = False at the start and True at the end. This single pair often turns a thirty-second macro into a two-second one, because Excel stops redrawing after every statement.
The security warning is not bureaucracy
VBA can read files, delete data, and reach the network. That makes a macro-enabled document an effective way to deliver malware, and it is why Excel blocks macros from downloaded files by default.
The behaviour you will see is a yellow bar saying macros have been disabled, and a file opened in Protected View. The correct response is to check the source and, if you trust it, use the unblock option on the file properties — not to disable macro security globally in the Trust Center.
The distinction matters because it separates the safe habit from the unsafe one. The unsafe habit is setting “enable all macros” so the warning stops appearing. The safe habit is signing your own macros with a self-signed certificate and trusting that certificate, so trusted code runs silently and unknown code stays blocked.
If what you want to build is an interactive sheet rather than a report, the same rules apply — the difference is only in what the code manipulates. Building browser-based Excel games is a good way to practise the object model, because the feedback is immediate: press the macro button, and you see whether the range moved.
When to use a macro and when not to
Not every repeated task needs one, and the distinction saves a lot of wasted effort.
Use a macro when the task is long, mechanical, and repeated — cleaning the same export every Monday, formatting a report the same way, splitting a file into month sheets.
Do not use one when a formula will do it. Formulas recalculate automatically and survive copying; a macro that computes a value has to be re-run whenever the data changes. If the answer is a cell value rather than a sequence of actions, a formula is almost always the better tool.
The other case to avoid is a macro built to work around a structural problem, such as five worksheets that should be one table. Fixing the structure removes the need for the automation entirely.
The short version
A macro is VBA stored in the workbook, recorded from your actions or written by hand. Save as .xlsm to keep it, or put it in the Personal Macro Workbook to reuse everywhere. Recording gives you a draft with fixed references; editing gives you a tool. And the security warning exists because macros can do real damage — trust code, not files.


