Maintenance Notification: We are upgrading our servers today so you may experience intermediate outages. Thank you for your patience.
Create and modify simple macros
MO-211

Edit simple macros

  1. 1Alt+F11 to open the Visual Basic Editor.
  2. 2Open the module the task names (Ctrl+R shows the Project Explorer).
  3. 3Change only the line the task describes: wait = 10 becomes wait = 15.
  4. 4Alt+Q to close the editor; keep the file as .xlsm.

Editing a macro is editing its VBA code. The tasks ask for one small change — a number, a name, a constant — and nothing else.

What the MO-211 task asks

Edit tasks in our MO-211 practice exams name the module and the change exactly: “The shipped macro TrailerBlock holds the trailer wait in a variable. Edit the code so wait = 15 instead of 10. Change nothing else.” Others swap a word: COPPERLINE for the old livery name, vbGreen for vbYellow, "2026" for "2025".

Our grader reads the code: that the new text is there, and that the old text is gone. It does not run the macro, so the edit has to read exactly as the task writes it.

Worked examples

Set up the grid below to follow along. Each example starts from it as shown; every result is what Excel showed.

Sheet the macro writes to
F
1Wait
210
Before the edit
Do this
  1. 1Run SetWait, the TrailerBlock module's macro (View › Macros › View Macros, Run).
Excel showsF2: 10

The macro sets wait = 10 and writes it into F2.

Make the edit
Do this
  1. 1Alt+F11, open the TrailerBlock module.
  2. 2Change wait = 10 to wait = 15.
  3. 3Alt+Q.
Excel showsThe line reads wait = 15

One line changes; everything else in the module stays as it was.

After the edit
Do this
  1. 1Run SetWait again.
Excel showsF2: 15

The macro now uses the new value.

In the video
Do this
  1. 1Alt+F11, the TrailerBlock module.
  2. 2wait = 10 becomes wait = 15.
  3. 3Alt+Q, run SetWait.
Excel showsF2: 15

The edit, done in Excel, then the macro run to show it.

Watch it done in Excel

The last example above, recorded in real Excel on the same grid.

Exam traps

Changing more than the task asks

“Change nothing else” is checked: the old text must be gone and nothing else broken. Do not tidy the rest of the code.

Spacing and quotes

The grader looks for the text as written: wait = 15, "2026" with its quotes. A string constant needs its quotes kept.

Editing the wrong module

A workbook can hold several modules. Open the one the task names in the Project Explorer.

Saving as .xlsx

The edit lives in the VBA project, which a .xlsx cannot hold. Keep the file as .xlsm.

FAQ

Do I need to save in the Visual Basic Editor?

The code is part of the workbook, so saving the workbook saves it. Alt+Q closes the editor and keeps the change.

Does editing the code change the sheet?

No. F2 still reads 10 after the edit; only running the macro writes the new 15.

Should I re-record the macro instead?

No. The task is marked on the named module's code, and recording writes a new macro somewhere else.

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.