ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum row totals for multiple items in a worksheet (https://www.excelbanter.com/excel-programming/424926-sum-row-totals-multiple-items-worksheet.html)

Mikey

Sum row totals for multiple items in a worksheet
 
How do I add all the numbers above a cell using generic range references and
then be able to move down the column and repeat the Sum function for all
records in the worksheet? There are way too many to do each manually. I can
get the macro to go to the cells where I want the Sum Totals but don't know
the code to "sum up" the values above that cell. I'v tryed the xlUp etc but
it gives me specific ranges each time. Suggestions are much appreciated.
--
Mickey

Bernard Liengme[_3_]

Sum row totals for multiple items in a worksheet
 
I am not clear on the question. Would you like to elaborate?
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mikey" wrote in message
...
How do I add all the numbers above a cell using generic range references
and
then be able to move down the column and repeat the Sum function for all
records in the worksheet? There are way too many to do each manually. I
can
get the macro to go to the cells where I want the Sum Totals but don't
know
the code to "sum up" the values above that cell. I'v tryed the xlUp etc
but
it gives me specific ranges each time. Suggestions are much appreciated.
--
Mickey




Mikey

Sum row totals for multiple items in a worksheet
 
I have expenses for numerous wells in a spreadsheet. There are many other
items included that are not expneses. I have a "Category" column to identify
the Expense rows with a Total line below them. I want to Total the expenses
for each well and move down the rows to the next Total line then sum all the
expenses above it. I can get my macro to goto the cell where I want the
total but don't have the skill set to produce a Sum function that adds as
many lines above the cell until it hits a blank cell at the top of the data
in the column. This is what I have that shows specific ranges (K14:K53) with
the Total for the cells in K53 and I need to have generic ones so I can
repeat the Sum formula for each well. There are different numbers of expense
rows for each well.

Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.End(xlUp)).Select
Range("W14:W53").Select
Range("W53").Activate
ActiveCell.FormulaR1C1 = "=SUM(R[-39]C:R[-1]C)"
Range("W14:W53").Select
Range("W53").Activate The formula gives the total in this cell
--
Mickey


"Bernard Liengme" wrote:

I am not clear on the question. Would you like to elaborate?
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mikey" wrote in message
...
How do I add all the numbers above a cell using generic range references
and
then be able to move down the column and repeat the Sum function for all
records in the worksheet? There are way too many to do each manually. I
can
get the macro to go to the cells where I want the Sum Totals but don't
know
the code to "sum up" the values above that cell. I'v tryed the xlUp etc
but
it gives me specific ranges each time. Suggestions are much appreciated.
--
Mickey






All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com