AIN3701
ACTIVITY 4.8
JUNE 2023
, AIN3701 Activity 4.8
Option Explicit
Sub PopulateInvoices()
'Turn off screen refreshing for performance
Application.ScreenUpdating = False
'Declare variables
Dim RecSales As Worksheet
Dim InvTemp As Worksheet
Dim lastRow As Long
Dim i As Long
Dim InvNum As String
Dim Wks As Worksheet
Const vatRate As Double = 1.15
'Set references to the relevant worksheets
Set RecSales =
ThisWorkbook.Worksheets("Recorded_Sales")
Set InvTemp = ThisWorkbook.Worksheets("Invoice
Template")
'Find the last row with data in the
"Recorded_Sales" sheet
lastRow = RecSales.Cells(RecSales.Rows.Count,
"I").End(xlUp).Row
'Loop through each row of data in the
ACTIVITY 4.8
JUNE 2023
, AIN3701 Activity 4.8
Option Explicit
Sub PopulateInvoices()
'Turn off screen refreshing for performance
Application.ScreenUpdating = False
'Declare variables
Dim RecSales As Worksheet
Dim InvTemp As Worksheet
Dim lastRow As Long
Dim i As Long
Dim InvNum As String
Dim Wks As Worksheet
Const vatRate As Double = 1.15
'Set references to the relevant worksheets
Set RecSales =
ThisWorkbook.Worksheets("Recorded_Sales")
Set InvTemp = ThisWorkbook.Worksheets("Invoice
Template")
'Find the last row with data in the
"Recorded_Sales" sheet
lastRow = RecSales.Cells(RecSales.Rows.Count,
"I").End(xlUp).Row
'Loop through each row of data in the