AIN3701
Assignment 2
DUE DATE 13 JUNE 2025
Guiding you towards academic excellence.
, Step-by-step VBA Code.
How to set in Excel:
1. Open Bookings_Feb_2025.xlsx.
2. Press Alt + F11 to open the VBA Editor.
3. Insert a Module (Right-click VBAProject → Insert → Module).
4. Paste both procedures below into the module.
5. Close the editor.
6. Save as Macro-Enabled Workbook: YourStudentNumber_Surname_Q1.xlsm.
7. Add a button from the Developer tab → assign the macro Recalculate_Revenue
to it.
1. Function Procedure (Question 1(a))
vba
CopyEdit
Function CalculateRevenue(destination As String, passengerType As String, tickets As
Integer) As Currency
Const CT_ADULT As Currency = 1800
Const CT_CHILD As Currency = 1350
Const DBN_ADULT As Currency = 1500
Const DBN_CHILD As Currency = 1125
Const WIND_ADULT As Currency = 3500
Const WIND_CHILD As Currency = 2625
Dim ticketPrice As Currency
Select Case destination
Case "Cape Town"
If passengerType = "Adult" Then
Assignment 2
DUE DATE 13 JUNE 2025
Guiding you towards academic excellence.
, Step-by-step VBA Code.
How to set in Excel:
1. Open Bookings_Feb_2025.xlsx.
2. Press Alt + F11 to open the VBA Editor.
3. Insert a Module (Right-click VBAProject → Insert → Module).
4. Paste both procedures below into the module.
5. Close the editor.
6. Save as Macro-Enabled Workbook: YourStudentNumber_Surname_Q1.xlsm.
7. Add a button from the Developer tab → assign the macro Recalculate_Revenue
to it.
1. Function Procedure (Question 1(a))
vba
CopyEdit
Function CalculateRevenue(destination As String, passengerType As String, tickets As
Integer) As Currency
Const CT_ADULT As Currency = 1800
Const CT_CHILD As Currency = 1350
Const DBN_ADULT As Currency = 1500
Const DBN_CHILD As Currency = 1125
Const WIND_ADULT As Currency = 3500
Const WIND_CHILD As Currency = 2625
Dim ticketPrice As Currency
Select Case destination
Case "Cape Town"
If passengerType = "Adult" Then