Macro sum

  • Thread starter Thread starter puiuluipui
  • Start date Start date
P

puiuluipui

Hi, i need a macro to sum every nea range and display result to the next cell
in the last row in colum "L".
Ex:
L M
total sum
15
2
8 25
total
7
7
5 19
I need a macro to sum only range that doesn't have a sum at the last
row/next cell.
I need macro to sum below total and to add sum. the problem is that i
allways add entries, so it will not be a range, so i need to sum the last
entries below total.
Can this be done?
Thanks!
 
Sub getsubtotalsSAS()
mc = "L"
lr = Cells(Rows.Count, mc).End(xlUp).Row + 1
For i = 2 To lr
If IsNumeric(Cells(i, mc)) Then msum = msum + Cells(i, mc)
If LCase(Cells(i, mc)) = "total" Or Cells(i, mc) = "" Then
Cells(i, mc).Offset(-1, 1) = msum
msum = 0
End If
Next i
End Sub
 
Back
Top