Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a Macro to Sum a Variable-Length Range (a Column)


Dave,

Thanks for your help.

I used: Target.FormulaR1C1 = "=SUM(R3C:R[-1]C)",
which is very similar to your suggestion.

A corollary question -- I have a column of numbers (each cell contain
a number), with a fixed starting cell but a variable ending cell.
want the macro to assign a Name (Workbook definition) to this range.
Any ideas?

Chuckles12

--
Chuckles12
-----------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...fo&userid=1494
View this thread: http://www.excelforum.com/showthread.php?threadid=26581

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using a Macro to Sum a Variable-Length Range (a Column)

Dim StartCell as Range
set StartCell = Range("B9")
range(StartCell,StartCell.End(xldown)).Name = "List1"


or

Sub Tester4()
Dim StartCell As Range
Set StartCell = Range("B9")
ThisWorkbook.Names.Add Name:="List1", RefersTo:= _
"=" & Range(StartCell, StartCell.End(xlDown)).Address(1, 1,
External:=True)
End Sub


--
Regards,
Tom Ogilvy




"Chuckles123" wrote in message
...

Dave,

Thanks for your help.

I used: Target.FormulaR1C1 = "=SUM(R3C:R[-1]C)",
which is very similar to your suggestion.

A corollary question -- I have a column of numbers (each cell contains
a number), with a fixed starting cell but a variable ending cell. I
want the macro to assign a Name (Workbook definition) to this range.
Any ideas?

Chuckles123


--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile:

http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=265814



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
Variable series length/range JessK Charts and Charting in Excel 1 March 3rd 06 04:02 AM
Sum a column of variable length? Brian Excel Discussion (Misc queries) 5 February 3rd 05 02:26 PM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_9_] Excel Programming 2 October 5th 04 12:34 AM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_2_] Excel Programming 1 October 3rd 04 11:51 PM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123 Excel Programming 2 October 3rd 04 01:12 PM


All times are GMT +1. The time now is 08:26 PM.

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

About Us

"It's about Microsoft Excel"