Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

DA 2.14: Automating sheet work with macros

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

55 minutes

The same ten clicks, every Monday

Every Monday a clerk opens the weekly sheet. They remove blank rows, fix the codes, add a total and save a copy. Ten clicks, every week.

A macro can do all ten in one go. But only if the sheet is the same each week.

Key words

WordWhat it means
Macroa saved set of steps that a program repeats
Automationgetting a computer to do a task by itself
Requirementsomething the automation must do
Standardised datadata laid out the same way each time
Recordingsaving your own clicks as a macro
Testrun the macro on sample data and check the result

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can plan a macro, check the data suits it and test the result.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Identify the requirements of the automation

Write down what the macro must do, in order, and what it starts with and ends with. Who runs it? How often? What must it never touch?

Good requirements are exact, such as "remove blank rows, fix codes, add a total".

The Monday job as recorded steps

StepActionNeeds the data to be
1Delete rows where the code is emptyCodes always in column A
2Trim spaces and use capitals in column ACodes always text
3Turn units into numbersUnits never words such as six
4Add a total row at the bottomNo blank rows inside the data

The cells students fill in are left blank in this preview.

Assess the standardisation first

A macro does the same steps every time. It cannot think. If a code sits in column B this week, or units say "six", the macro breaks or gives a wrong answer.

Check the sheet is standardised data: same columns, same order, same types.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

9 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.