Excel like a finance pro.
The functions, VBA, and shortcuts a finance operator actually uses — curated, with CFO examples. Prefer them pre-built? Grab a ready-made model.
Do the same thing to every worksheet
For Each over the tabs — format, clean, or stamp every sheet in one pass, skipping the ones you name.
1What it does
Loops through every worksheet in the workbook and applies the same action to each — here, autofit the columns and bold the header row — while skipping any tab you name (a Contents or Assumptions sheet). After the row loop, For Each ws In ThisWorkbook.Worksheets is the pattern you reach for most.
2The code
Sub LoopSheets()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
' Skip tabs you want to leave alone.
If ws.Name <> "Contents" Then
' The same action on every sheet — here, tidy the columns and
' bold the header row.
ws.Columns.AutoFit
ws.Rows(1).Font.Bold = True
End If
Next ws
Application.ScreenUpdating = True
End SubPaste into the Visual Basic Editor (Alt + F11 → Insert → Module), then run and save as macro-enabled (.xlsm).
New to macros? Set up in 5 minutes▾
- 1
Don't see the Developer tab in the ribbon?
You don't strictly need it — Alt + F11 opens the editor directly — but it makes running macros easier.- Windows: File → Options → Customize Ribbon → tick Developer in the right-hand list → OK.
- Mac:Excel → Preferences → Ribbon & Toolbar → tick Developer → Save.
- 2
Paste in the code
Press Alt + F11 to open the Visual Basic editor, then Insert → Moduleand paste the snippet's code into the blank window. Close it with Alt + Q. - 3
Run it
Press Alt + F8, pick the macro's name, and click Run — that's it. (Pasted a custom function instead? Just type it into a cell like any built-in:=GrossMargin(B2, B3).) - 4
Keep the macro — save as .xlsm
File → Save As → Excel Macro-Enabled Workbook (.xlsm). A plain .xlsx silently drops the code when you save. - 5
Macros blocked?
Click Enable Content on the yellow bar. If you downloaded the file, you may first need to right-click it → Properties → tick Unblock → OK, then reopen.
Heads up: macros can't be undone with Ctrl + Z — save a copy before running one that changes your workbook.
3When you use it
- Apply consistent formatting across every tab of a model.
- Clear filters, reset print areas, or freeze the header on all sheets at once.
- Run a per-sheet routine (export, total, validate) over the whole workbook.
4See it in action
A simulation — press Run to perform what the macro does to a sample workbook.
Workbook tabs
5Pitfalls
The macro touches a sheet it shouldn't (Contents, raw data).
Fix: Guard with If ws.Name <> "Contents" Then, or check a short list of names to skip.
Using .Select / ActiveSheet inside the loop is slow and error-prone.
Fix: Work through the ws object directly (ws.Columns.AutoFit) — you never need to activate a sheet to change it.
6No-code alternatives
- Group sheets by hand — Shift-click tabs to group them and edits apply to all — fine for a one-off, not a repeatable job.
Rather not write macros? Wauvel's free tools generate branded, formula-driven Excel for you — no VBA required.
Learn the moves here — or let Wauvel run them on your numbers.
Get my free report →