Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 ! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autosum variable range in macro
Jeff,
Thanks ! That works exactly like I had hoped ! -----Original Message----- 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 ! . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro - Using a variable number of columns in a Range | Excel Discussion (Misc queries) | |||
Range used in a macro needs to be variable | Excel Worksheet Functions | |||
variable range in a macro | Excel Discussion (Misc queries) | |||
Is it possible to set a variable range in a macro? | About this forum | |||
Autosum variable range in macro | Excel Programming |