Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
← Certified Microsoft Excel Expert Level Two · Lesson 6 of 9

Module Five

📖 Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
6
Module 5 · Certified Microsoft Excel Expert Level 2
MODULE 5

Macros and Automation

Module Introduction

Welcome to Module Five of your Certified Microsoft Excel Expert Level 2 course! In this module, we will learn about macros and automation. Macros are like magic spells that make Excel do work for you.

Think about all the tasks you do over and over again in Excel. What if Excel could do them for you with just one click? That is exactly what macros do. They record your actions and play them back whenever you need.

💡 What you will learn: Recording and running macros, saving macro-enabled workbooks, editing macros, enabling macros securely, and creating macros for common tasks.

Learning Objectives

By the end of this module, you will be able to:

  • Record a macro that automates repetitive tasks.
  • Run a macro with a button or shortcut key.
  • Save a workbook as a macro‑enabled file (.xlsm).
  • Understand macro security and how to enable macros safely.
  • Edit a macro in the Visual Basic for Applications (VBA) editor.
  • Create a macro for a common task like formatting or reporting.
  • Assign a macro to a button or shape for easy access.

Warm‑up Story

Kemi's Time‑Saving Magic

Kemi works in an accounting office in Lagos. Every month, she has to create a report with the same format: a title, a table, and a chart. It took her 20 minutes every time.

One day, her colleague said, "Why don't you record a macro? It will do all that work for you with one click!" Kemi did not know what a macro was. Her colleague showed her: she clicked View → Macros → Record Macro, then did all the steps she normally did. When she finished, she clicked Stop Recording.

Now, whenever Kemi needs to create a report, she just runs the macro. It automatically creates the title, the table, and the chart in seconds. She saves hours every month. Kemi learned that macros are like having a personal assistant in Excel.

Main Lessons

Lesson 1: What is a Macro?

Definition: A macro is a set of instructions that automates repetitive tasks in Excel.

Why it is important: Macros save time and reduce errors by doing the work for you.

Simple explanation: It is like recording a video of yourself doing a task, then playing it back whenever you want.

  • Real‑life example: A manager records a macro to format a monthly report.
  • School example: A student records a macro to add a header to every page.
  • Home example: A parent records a macro to format a budget.
  • Nigerian example: A shop owner records a macro to create a sales report.

📌 Mini summary: A macro automates tasks. It records your actions and plays them back to save time.

Lesson 2: Recording a Macro

Definition: Recording a macro means telling Excel to watch what you do and save it as a macro.

Why it is important: It is the easiest way to create a macro without writing code.

Simple explanation: It is like pressing "record" on a video camera.

  • Real‑life example: A manager records a macro to create a weekly report.
  • School example: A student records a macro to format a project.
  • Home example: A parent records a macro to organize a budget.
  • Nigerian example: A shop owner records a macro to print receipts.

How to record a macro:

  1. Go to the View tab.
  2. Click the arrow under Macros.
  3. Choose Record Macro.
  4. Give the macro a name (no spaces).
  5. Choose where to store it (This Workbook or Personal Macro Workbook).
  6. Optionally, assign a shortcut key (like Ctrl+Shift+M).
  7. Click OK.
  8. Perform the actions you want to record.
  9. Click View → Macros → Stop Recording.

📌 Mini summary: Recording a macro is easy. Just start recording, do your actions, and stop recording. Excel saves everything.

Lesson 3: Running a Macro

Definition: Running a macro means playing back the recorded actions.

Why it is important: It is how you use the macro to do your work.

Simple explanation: It is like pressing "play" on a video.

  • Real‑life example: A manager runs a macro to create a monthly report.
  • School example: A student runs a macro to format a project.
  • Home example: A parent runs a macro to update a budget.
  • Nigerian example: A shop owner runs a macro to generate sales data.

How to run a macro:

  1. Go to the View tab.
  2. Click Macros.
  3. Select the macro from the list.
  4. Click Run.

📌 Mini summary: Running a macro plays back your recorded actions. It is quick and easy.

Lesson 4: Macro-Enabled Workbooks

Definition: A macro‑enabled workbook is an Excel file that can contain macros. It has the extension .xlsm.

Why it is important: Normal workbooks (.xlsx) cannot store macros. You need to save as .xlsm.

Simple explanation: It is like a special container that can hold macros.

  • Real‑life example: A manager saves a report as .xlsm to keep the macros.
  • School example: A student saves a project as .xlsm.
  • Home example: A parent saves a budget as .xlsm.
  • Nigerian example: A shop owner saves a sales workbook as .xlsm.

How to save as macro‑enabled:

  1. Click File.
  2. Click Save As.
  3. Choose a location.
  4. In Save as type, choose Excel Macro-Enabled Workbook (*.xlsm).
  5. Click Save.

📌 Mini summary: Save as .xlsm to keep your macros. Normal .xlsx files cannot store macros.

Lesson 5: Macro Security

Definition: Macro security is a setting that controls whether macros can run on your computer.

Why it is important: Macros can sometimes contain harmful code. Security protects your computer.

Simple explanation: It is like a lock on your door. It keeps out things that might be dangerous.

  • Real‑life example: A company enables macros only from trusted sources.
  • School example: A student enables macros only for their own workbooks.
  • Home example: A parent enables macros only from trusted files.
  • Nigerian example: A shop owner enables macros only for their own files.

How to change macro security:

  1. Click File.
  2. Click Options.
  3. Click Trust Center.
  4. Click Trust Center Settings.
  5. Click Macro Settings.
  6. Choose Disable all macros with notification (safe) or Enable all macros (if you trust the source).
  7. Click OK.

📌 Mini summary: Macro security protects your computer. Only enable macros from trusted sources.

Lesson 6: The Personal Macro Workbook

Definition: The Personal Macro Workbook is a hidden workbook that stores macros you want to use in any Excel file.

Why it is important: It lets you use your macros in any workbook, not just the one where you recorded them.

Simple explanation: It is like a toolbox that you can carry to any job.

  • Real‑life example: A manager stores formatting macros in the Personal Macro Workbook.
  • School example: A student stores common macros for projects.
  • Home example: A parent stores budget macros.
  • Nigerian example: A shop owner stores sales macros.

How to save a macro to the Personal Macro Workbook:

  1. When recording a macro, choose Personal Macro Workbook in the Store macro in dropdown.
  2. The workbook is hidden. To unhide it, go to View → Unhide.

📌 Mini summary: The Personal Macro Workbook stores macros you can use in any Excel file. It is your personal toolkit.

Lesson 7: Assigning a Macro to a Button

Definition: Assigning a macro to a button means you can run the macro by clicking a button on your worksheet.

Why it is important: It makes running macros even easier and more user‑friendly.

Simple explanation: It is like having a remote control for your macro.

  • Real‑life example: A manager adds a "Run Report" button to a dashboard.
  • School example: A student adds a "Format" button to a project.
  • Home example: A parent adds a "Update Budget" button.
  • Nigerian example: A shop owner adds a "Print Sales" button.

How to add a button:

  1. Go to the Developer tab. (If you do not see it, go to File → Options → Customize Ribbon and check Developer.)
  2. Click Insert and choose a button (Form Control).
  3. Draw the button on your worksheet.
  4. In the dialog box, select the macro you want to assign.
  5. Click OK.

📌 Mini summary: Buttons make macros easy to run. Add them from the Developer tab.

Lesson 8: Editing a Macro in VBA

Definition: VBA (Visual Basic for Applications) is the programming language behind macros. You can edit macros in the VBA editor.

Why it is important: Editing macros lets you change them or make them more powerful.

Simple explanation: It is like editing a recipe to make it better.

  • Real‑life example: A manager edits a macro to add new features.
  • School example: A student edits a macro to change formatting.
  • Home example: A parent edits a macro to fix a bug.
  • Nigerian example: A shop owner edits a macro to change calculations.

How to edit a macro:

  1. Go to the Developer tab.
  2. Click Macros.
  3. Select the macro and click Edit.
  4. The VBA editor opens. Make your changes.
  5. Close the editor and save your workbook.

📌 Mini summary: You can edit macros in the VBA editor. It lets you customize them.

Lesson 9: Creating a Macro for a Common Task

Definition: A common task is something you do often, like formatting a report or creating a chart.

Why it is important: Automating common tasks saves the most time.

Simple explanation: It is like having a robot that does your chores.

  • Real‑life example: A manager creates a macro to format a monthly sales report.
  • School example: A student creates a macro to add a header to all pages.
  • Home example: A parent creates a macro to update a budget.
  • Nigerian example: A shop owner creates a macro to calculate daily sales.

Example macro idea:

  • Format a title: bold, 16pt, centre.
  • Add a table with borders.
  • Create a chart from selected data.

📌 Mini summary: Automating common tasks saves the most time. Think about what you do often and record a macro.

Lesson 10: Using Relative References in Macros

Definition: Relative references in macros mean the macro records actions relative to the active cell.

Why it is important: It makes macros more flexible because they work from anywhere.

Simple explanation: It is like giving directions that start from where you are, not from a fixed point.

  • Real‑life example: A macro that formats the row below the active cell.
  • School example: A macro that adds a number to the cell to the right.
  • Home example: A macro that enters today's date in the next cell.
  • Nigerian example: A macro that calculates a discount on the row below.

How to use relative references:

  1. Go to the Developer tab.
  2. Click Use Relative References before recording.
  3. Now, when you record, the macro will use relative references.

📌 Mini summary: Relative references make macros more flexible. They work from wherever you are.

Lesson 11: Macro Best Practices

Definition: Best practices are guidelines for creating effective macros.

  • Plan before recording: Know what steps you will take.
  • Use descriptive names: Name your macros clearly.
  • Test your macros: Run them to make sure they work.
  • Comment your code: Add notes to explain what the macro does.
  • Keep macros simple: Break complex tasks into smaller macros.

📌 Mini summary: Best practices help you create effective, reliable macros.

Key Vocabulary

Macro: A set of instructions that automates tasks.
Record Macro: The process of capturing actions to create a macro.
Run Macro: Playing back a recorded macro.
.xlsm: The file extension for macro‑enabled workbooks.
VBA: Visual Basic for Applications – the programming language for macros.
Personal Macro Workbook: A workbook that stores macros for use in any file.
Button: A control that runs a macro when clicked.
Relative Reference: An action recorded relative to the active cell.
Macro Security: Settings that control whether macros can run.
Automation: Using macros to do work automatically.

Important Concepts

  • Macros automate repetitive tasks and save time.
  • Recording is the easiest way to create a macro.
  • Save as .xlsm to keep your macros.
  • Macro security protects your computer from harmful code.
  • Buttons make macros easy to run.
  • Relative references make macros flexible.

Step-by-Step Explanations

How to Record and Run a Simple Macro

  1. Go to View → Macros → Record Macro.
  2. Name it FormatReport.
  3. Click OK.
  4. Select the title cell and make it bold and centre.
  5. Select the data and add borders.
  6. Click View → Macros → Stop Recording.
  7. To run it, go to View → Macros → select FormatReport → Run.
Start Recording
      |
      V
Format Title (Bold, Centre)
      |
      V
Add Borders to Data
      |
      V
Stop Recording
      |
      V
Run Macro to Apply Formatting!
    

How to Add a Button to Run a Macro

  1. Enable the Developer tab (File → Options → Customize Ribbon).
  2. Go to Developer → Insert → Button (Form Control).
  3. Draw the button on your worksheet.
  4. Select the macro you want to assign.
  5. Click OK.
  6. Click the button to run the macro.

Real-Life Examples

  • In a business: A manager records a macro to format a monthly sales report.
  • In a school: A teacher records a macro to grade student work.
  • At home: A parent records a macro to update a budget.
  • In Nigeria: A shop owner records a macro to generate daily sales reports.

Nigerian Examples

  • A bank in Lagos uses macros to format loan reports.
  • A school in Abuja uses macros to grade student assignments.
  • A shop in Kano uses macros to calculate daily sales.
  • A business in Enugu uses macros to generate invoices.

Fun Examples Children Can Relate To

  • Recording a macro to format a homework sheet.
  • Creating a macro to add your name to every page.
  • Using a button to run a "clean up" macro for your desk.
  • Making a macro that creates a to‑do list.

Everyday Examples

  • Recording a macro to format a weekly shopping list.
  • Creating a macro to add a header to all pages.
  • Using a macro to update a budget.
  • Making a macro that creates a chart.

Teacher Notes

  • Emphasise that macros are safe if used correctly.
  • Show students how to record and run macros.
  • Teach students to save as .xlsm.
  • Encourage students to create macros for their own tasks.

Parent Tips

  • Help your child record a macro for a common task.
  • Show them how to save as .xlsm.
  • Encourage them to use macros to save time.
  • Teach them about macro security.

Interesting Facts

  • Macros were introduced in Excel 5.0 in 1993.
  • VBA was introduced in Excel 5.0 in 1993.
  • The Personal Macro Workbook is stored in a folder called XLSTART.
  • You can have more than 100 macros in a workbook.

Did You Know?

Did you know? You can assign a macro to a shape or picture, not just a button.

Did you know? You can record a macro that works on any worksheet.

Did you know? You can add comments to your VBA code to explain what it does.

Remember This

  • Macros automate repetitive tasks.
  • Recording is the easiest way to create macros.
  • Save as .xlsm to keep macros.
  • Enable macros only from trusted sources.
  • Buttons make macros easy to run.

Common Mistakes

  • Forgetting to save as .xlsm: You will lose your macros.
  • Not enabling macros: They will not run.
  • Recording too many actions: Keep macros focused.
  • Not testing macros: Always test them.
  • Ignoring macro security: Only enable macros from trusted sources.

Best Practices

  • Plan your macro before recording.
  • Use descriptive names.
  • Test your macros.
  • Use relative references for flexibility.
  • Store reusable macros in the Personal Macro Workbook.

Comparison: .xlsx vs .xlsm

Feature.xlsx.xlsm
Can store macros?NoYes
SecuritySaferPotentially risky
File sizeSmallerLarger
Best forRegular workbooksWorkbooks with macros

Comparison: Absolute vs Relative References

FeatureAbsoluteRelative
Records fromFixed cellsActive cell
FlexibilityLessMore
Best forSpecific rangesFlexible positions

End-of-Module Summary

Congratulations! You have completed Module Five. You now know:

  • What macros are and how they automate tasks.
  • How to record and run macros.
  • How to save workbooks as macro‑enabled (.xlsm).
  • How to enable macros securely.
  • How to use the Personal Macro Workbook.
  • How to assign macros to buttons.
  • How to edit macros in VBA.

You are now ready to move on to Module Six, where you will learn about advanced charts and visuals.

Frequently Asked Questions

  1. What is a macro? A set of instructions that automates tasks.
  2. How do I record a macro? View → Macros → Record Macro.
  3. How do I run a macro? View → Macros → select macro → Run.
  4. What is .xlsm? A macro‑enabled workbook.
  5. What is VBA? Visual Basic for Applications – the macro language.
  6. What is the Personal Macro Workbook? A hidden workbook for personal macros.
  7. How do I add a button? Developer → Insert → Button.
  8. What are relative references? Actions recorded relative to the active cell.
  9. Why is macro security important? It protects your computer.
  10. Can I edit a macro? Yes, in the VBA editor.

Review Questions

  1. What is a macro?
  2. How do you record a macro?
  3. How do you run a macro?
  4. What is the file extension for macro‑enabled workbooks?
  5. What is VBA?
  6. What is the Personal Macro Workbook?
  7. How do you add a button to run a macro?
  8. What are relative references in macros?
  9. Why is macro security important?
  10. How do you edit a macro?
  11. What is the difference between .xlsx and .xlsm?
  12. What is the Developer tab?
  13. How can you make a macro available in all workbooks?
  14. What is a common use for macros?
  15. What is the best practice for naming macros?

Fill-in-the-Blank Exercises

  1. A __________ is a set of instructions that automates tasks.
  2. To record a macro, go to __________ → Macros → Record Macro.
  3. Macro‑enabled workbooks have the extension __________.
  4. VBA stands for __________ for Applications.
  5. The __________ Macro Workbook stores macros for use in any file.
  6. A __________ is a control that runs a macro when clicked.
  7. __________ references record actions relative to the active cell.
  8. __________ security controls whether macros can run.
  9. You edit macros in the __________ editor.
  10. Macros help you __________ repetitive tasks.

True or False

  1. Macros automate repetitive tasks. (True)
  2. You cannot edit a macro after recording it. (False)
  3. .xlsm files can store macros. (True)
  4. VBA is the language used for macros. (True)
  5. The Personal Macro Workbook is visible by default. (False)
  6. You can assign a macro to a button. (True)
  7. Relative references are not useful in macros. (False)
  8. Macro security is not important. (False)
  9. You can record a macro with a shortcut key. (True)
  10. Macros can only be used in one workbook. (False)

Multiple Choice Questions

  1. What is a macro?
    a) A set of instructions b) A chart c) A table d) A picture
    Answer: a
  2. How do you record a macro?
    a) View → Macros → Record Macro b) Insert → Macro c) Home → Macro d) Data → Macro
    Answer: a
  3. What is the file extension for macro‑enabled workbooks?
    a) .xlsx b) .xlsm c) .xls d) .csv
    Answer: b
  4. What is VBA?
    a) Visual Basic for Applications b) Very Basic Access c) Visual Basic Analysis d) View Basic Application
    Answer: a
  5. What is the Personal Macro Workbook?
    a) A workbook for personal macros b) A hidden workbook c) Both a and b d) None
    Answer: c
  6. How do you add a button?
    a) Developer → Insert → Button b) Home → Button c) Insert → Button d) View → Button
    Answer: a
  7. What are relative references?
    a) Actions relative to active cell b) Fixed actions c) Chart references d) Table references
    Answer: a
  8. Why is macro security important?
    a) Protects your computer b) Makes macros faster c) Both a and b d) None
    Answer: a
  9. How do you edit a macro?
    a) Developer → Macros → Edit b) Home → Edit c) Insert → Edit d) View → Edit
    Answer: a
  10. What is the difference between .xlsx and .xlsm?
    a) .xlsm stores macros b) .xlsx stores macros c) No difference d) .xlsm is older
    Answer: a
  11. What is the Developer tab?
    a) A tab for macro tools b) A tab for charts c) A tab for tables d) A tab for pictures
    Answer: a
  12. How can you make a macro available in all workbooks?
    a) Store it in Personal Macro Workbook b) Save as .xlsx c) Use absolute references d) Add a button
    Answer: a
  13. What is a common use for macros?
    a) Formatting reports b) Creating charts c) Updating data d) All of the above
    Answer: d
  14. What is the best practice for naming macros?
    a) Use descriptive names b) Use short names c) Use numbers d) Use special characters
    Answer: a
  15. What is the purpose of a button in Excel?
    a) To run a macro b) To add a picture c) To insert a chart d) To create a table
    Answer: a

Matching Exercises

Match the term on the left with its description on the right.

TermDescription
1. MacroA. File extension for macro workbooks
2. .xlsmB. The language used for macros
3. VBAC. A set of instructions that automates tasks
4. Personal Macro WorkbookD. A control that runs a macro
5. ButtonE. Stores macros for use in any file

Answers: 1-C, 2-A, 3-B, 4-E, 5-D

Short Answer Questions

  1. What is a macro and why is it useful?
  2. How do you record a macro?
  3. What is the difference between .xlsx and .xlsm?
  4. What is the Personal Macro Workbook and how do you use it?
  5. How do you add a button to run a macro?

Scenario-Based Exercises

  1. Scenario: You create the same monthly report every month. What can you do to save time?
  2. Scenario: You have recorded a macro but it only works on one worksheet. How can you make it work on any worksheet?
  3. Scenario: You want to make a macro available in all your workbooks. What should you do?

Group Activity

In groups of 3-4, create a macro that formats a sales report. Include formatting a title, adding borders, and creating a chart. Add a button to run the macro. Present your macro to the class.

Individual Activity

Create a macro that formats a weekly budget. Include a title, a table with borders, and a chart. Save the workbook as .xlsm. Add a button to run the macro.

Classroom Discussion Questions

  1. How can macros save you time in your daily work?
  2. What are some tasks you would automate with a macro?
  3. Why is it important to understand macro security?
  4. How does the Personal Macro Workbook help you?
  5. What is the most useful macro you can think of?

Mini Project

Project: "My Monthly Report Automation." Create a macro that generates a monthly sales report. Include a title, a table, and a chart. Save it as .xlsm. Add a button to run the macro. Present your project to the class.

Practical Assignment

Open Excel. Create a macro that formats a list of names. Include bold formatting, borders, and a header. Save the workbook as .xlsm. Add a button to run the macro.

Challenge Exercise

Create a macro that imports data from another workbook, formats it, and creates a chart. Use relative references so the macro works anywhere. Add a button to run the macro. Save it as .xlsm.

Quiz Answers

Fill-in-the-Blank Answers:

  1. macro
  2. View
  3. .xlsm
  4. Visual Basic
  5. Personal
  6. button
  7. Relative
  8. Macro
  9. VBA
  10. automate

True or False Answers: 1-T, 2-F, 3-T, 4-T, 5-F, 6-T, 7-F, 8-F, 9-T, 10-F

Key Takeaways

  • Macros automate repetitive tasks and save time.
  • Recording is the easiest way to create a macro.
  • Save as .xlsm to keep your macros.
  • Macro security protects your computer.
  • Buttons make macros easy to run.
  • Relative references make macros flexible.

Preparation for the Next Module

In Module Six, you will learn about Advanced Charts and Visuals. You will learn how to create professional charts like dual‑axis, waterfall, and histogram charts. Keep practising what you learned in this module, and you will be ready for the next step.


Module 5 · Macros and Automation · Certified Microsoft Excel Expert Level 2 Course

🏆 Get Certified

🔒

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (₦2,000 or 20,000 coins), and get a verified certificate with your name on it.

🎓 Sign Up to Get Certified
🛠️ Practice Tools
Hands-on simulators & labs - subscription required.
→
🎯 Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
→