ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Column Subtotal Question (https://www.excelbanter.com/excel-programming/422001-column-subtotal-question.html)

brentm

Column Subtotal Question
 
I have a spreadsheet that I need to add a column subtotal for column C and
column D. the number of rows will vary from one run to the next. the other
issue I have is that all rows with a value in column D are listed (by sort)
below all rows with a value in column C. I can add subtotals, but I do not
know how to set the range to be dynamic. Also, I need the subtotals to be 2
rows below the last row with a value in column D. I am stumped!

Don Guillett

Column Subtotal Question
 
I need the subtotals to be 2 rows below the last row with a value in
column D. I am stumped!

You would need to have the value set by a macro

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"brentm" wrote in message
...
I have a spreadsheet that I need to add a column subtotal for column C and
column D. the number of rows will vary from one run to the next. the
other
issue I have is that all rows with a value in column D are listed (by
sort)
below all rows with a value in column C. I can add subtotals, but I do
not
know how to set the range to be dynamic. Also, I need the subtotals to be
2
rows below the last row with a value in column D. I am stumped!



ryguy7272

Column Subtotal Question
 
Something like this:

Dim lastrow as Long
lastrow = .Cells(.Rows.Count, "C").End(xlUp).Row
.Cells(lastrow, "C").Activate
ActiveCell.FormulaR1C1 = "=sum(r6c:r[-1]c)"

HTH,
Ryan---



--
RyGuy


"brentm" wrote:

I have a spreadsheet that I need to add a column subtotal for column C and
column D. the number of rows will vary from one run to the next. the other
issue I have is that all rows with a value in column D are listed (by sort)
below all rows with a value in column C. I can add subtotals, but I do not
know how to set the range to be dynamic. Also, I need the subtotals to be 2
rows below the last row with a value in column D. I am stumped!



All times are GMT +1. The time now is 10:35 PM.

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