Macro sum

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!
 
D

Don Guillett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top