View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
J_Gold J_Gold is offline
external usenet poster
 
Posts: 3
Default insert formula in last cell

Hi David - Thanks! hadn't even thought of taking it that far - perfect
solution.

Cheers,

Angela


"David McRitchie" wrote in message
...
Hi Angela,
Implementing your formula would be half of the solution, so if you
would like to see how to invoke a subroutine to place a SUBTOTAL
at the end of the current column on a rightclick see
macro endtotal_sub implemented into your rightclick (context) menu in
Right Click Menus (Context Menus) in Excel
http://www.mvps.org/dmcritchie/excel/rightclick.htm

The macro itself would be

Sub EndTotal_sub()
Dim end_data As Long 'dmcritchie RClick 2005-05-28
Range(ActiveCell.Address, _
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Address).Select
end_data = ActiveSheet.Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
ActiveSheet.Cells(end_data + 1, ActiveCell.Column).Formula = _
"=SUBTOTAL(9," & ActiveSheet.Cells(2, ActiveCell.Column).Address(1, 0) _
& ":OFFSET(" & ActiveSheet.Cells(end_data + 1, _
ActiveCell.Column).Address(0, 0) & ",-1,0))"
End Sub
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"J_Gold" wrote l...
Hi Mike - thanks, works great!

Cheers,

Angela
"Mike Fogleman" wrote in message
...
Angela, This should do it for you: [clipped]