#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Macro sum

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!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro sum


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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"puiuluipui" wrote in message
...
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!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"