Excel like a finance pro.
VBA · Getting started
Recording a macro
Excel writes the code for whatever you do, a good way to learn object names.
When to use it
The macro recorder writes VBA for everything you do in the interface. It is the fastest way to discover the object names and property values for a task, even though the recorded code needs cleanup.
The code
- Code
Developer > Record Macro, do the steps, Stop Recording, then read the code.
Worked examples
Learn a property
Developer > Record Macro, format a range, Stop Recording, Alt + F11 → Code like Selection.NumberFormat = "#,##0.00"
Now you know the property name.
Learn a method
Record a sort, then read the code → A Sort block with Key, Order, and Header arguments
Copy the arguments into your own procedure.
Relative recording
Record with "Use Relative References" on → Offsets from the active cell instead of fixed addresses
For macros that run wherever the cursor is.
Worth knowing
- Recorded code is verbose and full of Select and Activate; clean it up.
- Delete the Select and Activate lines and work with ranges directly.
- Recorded code repeats every dialog default; trim to the properties you changed.
- Record into the Personal Macro Workbook to reuse across files.
Where it goes wrong
- The recorder cannot record loops, conditions, or dialogs; write those by hand.
- Recorded absolute references break when the sheet layout changes.
Related
Learn the moves here — or let Wauvel run them on your numbers.
Meet your AI CFO →One CFO-grade Excel tip a week
A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.