View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default 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!