View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeffrey Marcellus Jeffrey Marcellus is offline
external usenet poster
 
Posts: 7
Default Autosum variable range in macro

Eric, you could try something like the following. The only requirement is
that cells in the list are nonblank.
--
ActiveCell.Value = "=sum(" & ActiveCell.Offset(-1, 0).End(xlUp).Address &
":" & ActiveCell.Offset(-1, 0).Address & ")"
--
Good luck,
Jeff

"Eric Dreshfield" wrote in message
...
I would like to be able to add programming to a macro that
mimics the AutoSum key....for example, if cells A1 through
A10 have values and the active cell is A11, I want the
macro to create the =Sum(a1:a10) formula, but I do not
want the cell references hard coded, as the number of rows
will vary each time this process is run. Any suggestions ?

Thanks !