Hello folks, I have been a member here for.... Well, years lol. and this is my first post.
Lurked and found a lot of info here, but with this one im a bit stumped.
Hoping someone can help
So I have this Macro that works well, I however only want to total the last chunk of data (17 - 20 rows) at a time. The total is manipulated in some cases based on other criteria, and with this maco, everytime i add another chunk and rerun this macro it resets my maniplulated totals.
The ideal solution is for an autosum just the last chunk, from the bottom row up to the first blank. Then as you will see its stored in 2 places.
Hope that makes sense. here is the code
Sub AutoSum2()
Const SourceRange = "H:H"
Dim NumRange As Range, formulaCell As Range
Dim SumAddr As String
Dim c As Long
For Each NumRange In Columns(SourceRange).SpecialCells(xlConstants, xlNumbers).Areas
SumAddr = NumRange.Address(False, False)
Set formulaCell = NumRange.Offset(NumRange.Count, 4).Resize(1, 1)
formulaCell.Formula = "=SUM(" & SumAddr & ")"
Set formulaCell = NumRange.Offset(NumRange.Count, 1).Resize(1, 1)
formulaCell.Formula = "=SUM(" & SumAddr & ")"
'change formatting to your liking:
formulaCell.Font.Bold = True
formulaCell.Font.Color = RGB(255, 0, 0)
formulaCell.Interior.ColorIndex = 6
c = NumRange.Count
Next NumRange
End Sub
Bookmarks