Dim lr As Long
lr = Cells(Rows.Count, "H").End(xlUp).Row
Dim cell As Range, s As Long, c As Long, curr As Currency
s = 1
c = 0
For Each cell In Range("H1:H" & lr)
If cell.Offset(0, -2).Value = "Total incl. GST" Then
'With r
c = cell.Value + c
'.Formula = "=sum(r" & s & "c:r" & r.Row - 1 & "c)"
' End With
End If
Next cell
curr = c
With ActiveSheet.PageSetup
.DifferentFirstPageHeaderFooter = True
.FirstPage.CenterFooter.Text = ""
'This inserts the date in the left footer
.LeftFooter = Format(Now(), "mmmm d, yyyy")
'This inserts the reference number and the total price in the footer at the centre, one of top of the other.
.CenterFooter = ref3 & " " & Chr(10) & curr
End With