I got a problem with sum of rows formula in vba. I am using the below code. When I check the value in Range("H3").Formula
its giving me the correct value =SUM(C5:G5)
But the problem is its not reflecting in the excel cell.
Range("H3").Formula = "=SUM(" & Range(Cells(5, 3), Cells(5, 7)).Address(False, False) & ")"
You need to fully qualify the cells (notice the dots). Try this
'~~> Replace this with the relevant sheet
With Sheets("Sheet1")
.Range("H3").Formula = "=SUM(" & _
.Range(.Cells(5, 3), .Cells(5, 7)).Address(False, False) & _
")"
End With
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.