HI, Can someone help and will tell me what's wrong with this command: (Code, 1 line) Thanks Nati
Jun 8th 2021 #1 HI,Can someone help and will tell me what's wrong with this command: Code Range("r1") = "=sum(" & Range(Cells(1, 1), Cells(Lrow, Lcol)) & ")" ThanksNati
Jun 8th 2021 #3 If you're trying to put a formula in there, you need the address of the range: Code Range("r1") = "=sum(" & Range(Cells(1, 1), Cells(Lrow, Lcol)).Address & ")" or just: Code Range("r1").FormulaR1C1 = "=sum(R1C1:R" & Lrow & "C" & Lcol & ")" If you just want the value, then: Code Range("r1").Value = Worksheetfunction.Sum(Range(Cells(1, 1), Cells(Lrow, Lcol)))
Jun 8th 2021 #5 Sorry, I answered to fast.The second option worked greatthis one - (Range("r1").FormulaR1C1 = "=sum(R1C1:R" & Lrow & "C" & Lcol & ")")