Project level 3: monthly report by region

To finish level 3 you build a monthly report of the kind many sales teams still put together by hand: one sheet per region with its orders and a total, and a summary with sales, order count and share per region. Three macros that turn an order list into a finished report.

You need: Worksheets (Worksheets, Add, For Each over sheets), Format cells, WorksheetFunction (Sum, SumIf, CountIf), Dates (Format) and finding the last row from level 2.

The situation

Carter Office Supplies delivers to business customers in three regions. All orders for the month sit on the Data sheet: date, region, customer, amount. At month end, each regional manager wants their own orders on a sheet of their own, with a total underneath. The managing director wants a single page with sales per region and each region's share of the total.

So far someone copies the rows by hand, adds up the totals and formats everything again. It takes time and goes wrong as soon as a region is added or a late order comes in. Your macros should work for any number of orders and regions, which is why Check tests them with more rows, an extra region and data from a different month.

The project

Part 1: one sheet per region

The regions are listed in column F of the data sheet. Each one gets a sheet with headers. Keep an eye on which sheet is active after you add one.

Task For the monthly report, every region gets a sheet of its own. Write a macro AddRegionSheets that adds a new sheet after the last one for every region in column F (from F2 down to the last) and names it after the region. Every new sheet gets the headers "Date", "Customer" and "Amount" in A1:C1, in bold.

ABCDEF
1DateRegionCustomerAmountRegions
23 Mar 2026NorthCarter Ltd1,250.00North
34 Mar 2026SouthDelgado Builders980.00South
49 Mar 2026WestPacific Freight2,310.00West
516 Mar 2026NorthHughes and Sons415.00

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

Part 2: distribute and total the orders

The region sheets exist now. Every order should land on its region's sheet, with a bold total row underneath. You do not need an If to pick the sheet: its name is already in the cell.

Task The region sheets exist. Write a macro Distribute in two steps. First: every order from Data (from row 2) goes onto the sheet of its region (column B), into the next free row, with the date in A, customer in B and amount in C. Second: on every region sheet, below the last order, add a row with "Total" in A and the total of the amounts in C (WorksheetFunction.Sum), both in bold. The amounts and the total get the format "#,##0.00".

Data

ABCD
1DateRegionCustomerAmount
23 Mar 2026NorthCarter Ltd1,250.00
34 Mar 2026SouthDelgado Builders980.00
49 Mar 2026WestPacific Freight2,310.00
510 Mar 2026NorthHughes and Sons415.00
616 Mar 2026SouthBaker and Co1,720.00
718 Mar 2026NorthBrooks Supply640.00

North

ABCD
1DateCustomerAmount
2
3
4
5

South

ABCD
1DateCustomerAmount
2
3
4
5

West

ABCD
1DateCustomerAmount
2
3
4
5

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

Part 3: the summary

For the managing director: sales and number of orders per region, a total row, and each region's share as a percentage. The heading names the month, which the macro reads from the data.

Task Now the summary on the Report sheet. The macro BuildReport should: 1. write "Monthly report " plus the month of the first order into A2 (Data!A2, using Format(…, "mmmm yyyy"), here "Monthly report March 2026") and make A2 bold. 2. for every region from row 5, write the sales to B with SumIf and the number of orders to C with CountIf. 3. below that, add a "Total" row with the sum of B and C (WorksheetFunction.Sum), in bold. 4. in D, the share of each region in total sales, formatted "0.0%". Column B gets "#,##0.00" from row 5.

Report

ABCD
1Carter Office Supplies, Sales
2
3
4RegionSalesOrdersShare
5North
6South
7West

Data

ABCD
1DateRegionCustomerAmount
23 Mar 2026NorthCarter Ltd1,250.00
34 Mar 2026SouthDelgado Builders980.00
49 Mar 2026WestPacific Freight2,310.00
510 Mar 2026NorthHughes and Sons415.00
616 Mar 2026SouthBaker and Co1,720.00
718 Mar 2026NorthBrooks Supply640.00
8
9
10

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

What matters

Name every sheet

In all three parts, the macro works across several sheets. Cells without a sheet in front means the active sheet, and that changes: after Worksheets.Add, the new sheet is in front. Set up object variables at the start (Set dataWs = Worksheets("Data")) and put them in front of every Range and Cells, Rows.Count included.

Values first, then totals, then shares

The order follows from what depends on what. A region sheet's total is only right once all orders are in place. The share needs total sales, so it comes after the total row. Step through shows you the order in which your macro fills the cells.

Find the free row every time

Every order you move makes the target sheet one row longer, so the next free row has to be worked out again for each order: target.Cells(target.Rows.Count, 1).End(xlUp).Row + 1. Without the + 1, each order overwrites the one before.

Values, not formulas

WorksheetFunction writes finished numbers into the cells. For a report that is sent out at month end, that is fine. If the sheet should keep calculating later, formulas would be better; writing formulas from a macro comes in level 4.

If it does not work

  • Part 1 stops with "Run-time error '1004': Application-defined or object-defined error": the sheet name was empty. Usually Cells(r, 6) without dataWs. in front reads from the new, empty sheet.
  • Part 1 reports "Bold is not right in North!A1 (Font.Bold).": the headers are there but not bold.
  • Part 2 reports "Run-time error '9': Subscript out of range": a sheet name was not found. Check that you read the region from column B, not the customer from column C.
  • Part 2 reports a wrong number format on the Data sheet: the total loop did not skip the data sheet. The If with ws.Name <> "Data" is missing.
  • In part 2, a region sheet holds only one order and its header is gone: the + 1 is missing from the free row.
  • Part 3 stops with "Run-time error '11': Division by zero": the share is calculated before the total row is filled.
  • The heading in part 3 is wrong: "mmm" gives the short month name; the full name is "mmmm". A month typed into the code shows up when Check uses data from a different month.

What you learned in level 3

You refer to sheets by name, add new ones and loop through them all. You format ranges and single rows by condition, use Excel functions such as SUMIF and VLOOKUP inside a macro, split and clean text, calculate with dates and write your own functions. That is enough to build reports that used to be put together by hand every month. Level 4 moves on to larger amounts of data: copying, deleting, sorting, searching and writing formulas.

FAQ

How many points is the project worth?

Each of the three parts is worth 15 points instead of the usual 10, because you solve several steps together.

Is the project free?

No. Projects from level 2 onwards are part of Premium. In the level 3 lessons, the first exercise on each page is free, so you can prepare without Premium.

Is there only one right answer?

No. Check looks at the result on the sheets, not at the text of your code. For Next or For Each, copying values one by one or with Resize: it makes no difference. Only .Select and .Activate are not accepted.

Why are there no formulas in the total rows?

Because the report is meant as a finished result. You learn to write formulas into cells in level 4, and can then rebuild the report if you like.

What if I get stuck?

The hints under each task help in three steps: first the idea, then the structure, then almost finished code. If that is not enough, go back to the lesson on the building block that is giving you trouble; the links are at the top of this page.

Level 3 complete

Next up is level 4, working with data. It starts with copy and paste: moving ranges to other sheets, pasting values only and copying rows by condition.

Learn copy and paste in VBA

Write to us

Choose language

Select your preferred language