diff --git a/DelCellAutomationV1.bas b/DelCellAutomationV1.bas index d5ae784..c783d80 100644 --- a/DelCellAutomationV1.bas +++ b/DelCellAutomationV1.bas @@ -186,7 +186,7 @@ Sub finalSum() Set sumcells = Range("A1").Offset(3, 0).End(xlDown).Offset(1, 2) With sumcells - .Formula = "=SUM(" & Range(Range("A1").Offset(1, 2), sumcells.Offset(-1, 0)).Address & ")" + .Formula = "=SUM(" & Range(sumcells.Offset(-1, 0).End(xlUp).Offset(1, 0), sumcells.Offset(-1, 0)).Address & ")" .Offset(-1, 0).Copy .PasteSpecial Paste:=xlPasteFormats .Offset(0, -1).Value = "Total"