Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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 !



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro - Using a variable number of columns in a Range stumped Excel Discussion (Misc queries) 2 October 3rd 06 08:13 PM
Range used in a macro needs to be variable DaveP Excel Worksheet Functions 3 November 4th 05 03:23 PM
variable range in a macro AMK Excel Discussion (Misc queries) 3 July 6th 05 09:32 AM
Is it possible to set a variable range in a macro? Mary About this forum 0 June 12th 05 06:26 PM
Autosum variable range in macro Tom Moore [MSFT] Excel Programming 1 September 3rd 03 10:52 PM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"