Record simple macros
- 1View › Macros › Record Macro.
- 2Macro name: FormatHeader. Store macro in: This Workbook. OK.
- 3Do the steps once: select A1:D1, then Ctrl+B for bold.
- 4View › Macros › Stop Recording.
The recorder writes VBA for each thing you do between Record Macro and Stop Recording. Run the macro later and Excel repeats those steps.
What the MO-211 task asks
A recording task in our MO-211 practice exams gives the name, where to store it and the steps: “Record a macro named FormatHeader (store it in this workbook) that selects A3:F3 on the Log sheet, makes it bold, and fills it with Light Blue … Stop recording when done.”
Several add an instruction for afterwards: “Undo afterwards so the child fares are back — the grader marks the macro, not the deletion.” Our grader opens the macro itself: that a module exists, that a macro of that name exists, and that its code does the step (ClearContents for clearing, Visible for hiding a sheet, Hidden for hiding columns).
Worked examples
Set up the grid below to follow along. Each example starts from it as shown; every result is what Excel showed.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Date | Vessel | Berth | Fee |
- 1View › Macros › Record Macro.
- 2Name FormatHeader, This Workbook, OK.
- 3Select A1:D1, Ctrl+B for bold.
- 4View › Macros › Stop Recording.
The recorder stored the steps as a macro in a new module in this workbook.
- 1Clear the bold from A1:D1.
- 2View › Macros › View Macros, FormatHeader, Run.
The macro selects exactly the range you selected while recording.
- 1File › Save As, type Excel Macro-Enabled Workbook (.xlsm).
A .xlsx file cannot hold VBA, so saving as .xlsx drops the macro.
- 1Record Macro, FormatHeader, This Workbook.
- 2Select A1:D1, Ctrl+B.
- 3Stop Recording.
The first example, done in Excel on the same sheet.
Watch it done in Excel
The last example above, recorded in real Excel on the same grid.
Exam traps
The macro then lives in your own hidden workbook, not in the exam file, and the grader finds no module there. Choose This Workbook.
Everything after Record Macro is recorded until you stop, including the clicks that come after the task.
A macro cannot be stored in a .xlsx: it is lost when the file is saved that way. Exam files with macros are .xlsm.
If the task says to undo the macro's effect afterwards, do it: the sheet is checked in its original state, and the macro is still marked.
FAQ
Do I need the Developer tab?
No. View › Macros has Record Macro, Stop Recording and View Macros, which is all a recording task needs.
Where does the macro go?
Into a module in this workbook; the first module is named Module1. The grader checks that the workbook has one.
Can I see the code it wrote?
Yes: Alt+F11 opens the Visual Basic Editor, and the recorded macro is in a module under this workbook.
Try it under exam conditions
Take a full, timed MO-211 practice exam, upload the workbook you built, and get a score out of 1000 with a per-task breakdown of where the points went. Your first one is free.
No credit card needed.
