Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

DISC 112: Assignment 10 

(Total: 20 Marks)

Follow the instructions in the given order to complete the assignment: 


1. Open the provided ‘Lab 10’ Excel workbook.  
2. Save the workbook in D Drive and name it after Assignment number and your roll
number (e.g. A10-2020-11-001). 
3. Rename the main worksheet as Group Information and enter the information for your
group as follows. 

Introduction to VBA + MACROS


Task 1 (3+2 Marks):
Open the worksheet “Product Details”.

a) Record a macro which inserts the following table anywhere on the worksheet. Name the Macro
“Item Details”. Give it a suitable description. (Formatting should be close to the given example if not
exactly the same).

b) Insert a button on the worksheet which can run your “Item Details” Macro. Rename the button as
“Insert Item Details”. Then using the button, populate your worksheet with the tables as shown
below.
Task 2 (3+5 Marks):
Move to the “PNL” worksheet.

a) Record a Macro named “ProfitandLoss” which inserts the following on the top right of a
worksheet only. Give it a suitable description. (Formatting should be close to the given example
if not exactly the same).
b) Look at the data in the “Data Entered” worksheet. We will now use that to populate our profit
and loss statement using macros (assuming that the data entered, and profit and loss statement
are always given in these same cells).
Record a macro named “DataFill” which inputs data from “Data Entered” worksheet (through
referencing) the following in the profit and loss statement:
 Sum of sales in D6
 Sum of Cogs in D7
 Sales-COGS in D9
 Fixed Expenses in D12-D15
 Sum of fixed expenses in D16
 Gross Profit – Sum of fixed expenses in D17

The result of this macro should be a fully populated profit and loss statement.

Task 3 (2+2 Marks):


Move to the “Monthly Sales” worksheet.

a) Record a Macro named “Monthly_Sales” which inserts the following table on the top right of a
worksheet only. Give it a suitable description. (Formatting should be close to the given example
if not exactly the same).

b) Create a new workbook. Label that as “Rollnumber – Part2” and save it as an .xlsx file (we don’t
want to retain any macros in this file but we do wish to run a macro here from our first
workbook).
Run the “Monthly_Sales” macro to create the monthly sales worksheet in this workbook. Then
save the progress and close this workbook. Submit it along with the main workbook.

Task 4 (3 Marks):
Move to the “Model” worksheet.

Demand for crisps changes based on the price set. This eventually affects the total sales for crisps. The
basic model and formulas are set in the worksheet.

Use the right Form Control Button and link it to the crisp’s price such that:

 Clicking the button increments prices changes by 1


 Max price can be 18 while the lowest price can be 7

Observe the changes in demand and sales with change in prices when you click the button.

You might also like