From 65602c1c30a1c6e57cdbb4718958bd499581e9d8 Mon Sep 17 00:00:00 2001 From: QaruzDin Date: Wed, 25 Sep 2024 22:49:39 +0700 Subject: [PATCH] Fixing reference cell for the formula of 'finalSum' sub --- DelCellAutomationV1.bas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"