Using June as an Example
June is J16: P21
Select that edit the Orange CF
Use this modified formula
ie: Use the Month of the Month and Month of the Date as an extra check
AS debaser described, the On error is still active once triggered
If another error occurs it will go back to 10
so you need to a reset statement as described into the end of the error handling to stop that behaviour
The below is what you want
I'm not sure where you want to jump back to, so adjust accordingly
Do Until surplus = 0
adr = "AF" & lmin & ":AF" & lmax & ""
If lmax - lmin = 0 Then
min = Application.WorksheetFunction.Subtotal(5...