Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert SUM function for range

Dear All,

I have a variable range of data in a column. Exactly at
the bottom of this column I need to insert a SUM function
for the numbers above (not just calculate the totals). I
tried
ActiveSheet.Range("a6").End(xlDown).Offset(1, 0).Formula
= "=SUM(a2:(Range("a6").End(xlDown))"
but it's not working

Please advise!

Thanks.

Denis Petrov
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Insert SUM function for range

Denis,

I like to work with R1C1 notation:
ActiveSheet.Range("a6").End(xlDown).Offset(1, 0).FormulaR1C1 _
= "=SUM(R2C:R[-1]C)"

Since there is no number after 'C', the formula is generic for any column.
And it doesn't matter if your worksheet displays columns with alpha or
numeric.

--
sb
"Denis Petrov" wrote in message
...
Dear All,

I have a variable range of data in a column. Exactly at
the bottom of this column I need to insert a SUM function
for the numbers above (not just calculate the totals). I
tried
ActiveSheet.Range("a6").End(xlDown).Offset(1, 0).Formula
= "=SUM(a2:(Range("a6").End(xlDown))"
but it's not working

Please advise!

Thanks.

Denis Petrov



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Insert SUM function for range

ActiveSheet.Range("a6").End(xlDown).Offset(1, 0).Formula _
= "=SUM(a2:" & Range("a6").End(xlDown).Address & ")"

or

Activesheet.Range("A6").End(xldown).Offset(1,0).Fo rmulaR1C1 = _
"=Sum(R2C:R[-1]C)"

--
Regards,
Tom Ogilvy


"Denis Petrov" wrote in message
...
Dear All,

I have a variable range of data in a column. Exactly at
the bottom of this column I need to insert a SUM function
for the numbers above (not just calculate the totals). I
tried
ActiveSheet.Range("a6").End(xlDown).Offset(1, 0).Formula
= "=SUM(a2:(Range("a6").End(xlDown))"
but it's not working

Please advise!

Thanks.

Denis Petrov



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Insert SUM function for range

To add to what you have gotten, if you want just the sum without the formula
Sub sumem()'from a2 to a2 end xl down
ActiveSheet.Range("a6").End(xlDown).Offset(1, 0) = _
Application.Sum(Range(Cells(2, 1), Cells(Range("a6").End(xlDown),1)))
End Sub

"Denis Petrov" wrote in message
...
Dear All,

I have a variable range of data in a column. Exactly at
the bottom of this column I need to insert a SUM function
for the numbers above (not just calculate the totals). I
tried
ActiveSheet.Range("a6").End(xlDown).Offset(1, 0).Formula
= "=SUM(a2:(Range("a6").End(xlDown))"
but it's not working

Please advise!

Thanks.

Denis Petrov



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
HOW DO i INSERT A RANGE OF SERIAL DATES IN THE WORKDAY FUNCTION rosemontbill Excel Worksheet Functions 1 October 15th 09 05:47 PM
Insert range of cells with a function firsttimer Excel Worksheet Functions 2 May 29th 07 09:43 AM
How do I insert a calculated cell range into an excel function Gary Wallis Excel Worksheet Functions 2 April 26th 07 03:28 PM
How to insert from name range into a paragraph? misterno Excel Worksheet Functions 2 March 9th 07 03:52 PM
Insert...Name Range childofthe1980s Excel Discussion (Misc queries) 1 May 24th 05 03:52 PM


All times are GMT +1. The time now is 06:38 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"