Hello. How do I create sum formulas in column D only in the first blank rows above which there is data in the cells. So, D1:D5 has data, D6 is blank, sum D1:D5 in D6, and so on. Thanks.
Hello. How do I create sum formulas in column D only in the first blank rows above which there is data in the cells. So, D1:D5 has data, D6 is blank, sum D1:D5 in D6, and so on. Thanks.
It depends on structure data, easier with an attached sample workbook …
A way :
PHP Code:
Sub Demo()
Dim Rf As Range, Rt As Range
Set Rf = Sheet1.Cells(4)
Set Rt = Rf.End(xlDown)
Rt(2).Formula = "=SUM(" & Range(Rf, Rt).Address & ")"
Set Rf = Nothing
Set Rt = Nothing
End Sub
Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
This code has an error. Spreadsheet attached.I want to sum blank rows above which there is data.
Hi ammartino44,
try this
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks