LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Summing Cells Above

This should be so simple, but I'm struggling. I want to sum a column of
contiguous numbers and put the total in the first empty cell beneath them.
The number of cells summed varies depending on the column.

When recording this and reviewing the code, the VB Editor gives me the
following:

ActiveCell.FormulaR1C1 = "=SUM(R[-15]C:R[-1]C)"

where -15 is the number of cells to be added. Of course, this changes
depending on the number of cells to be added. I've tried creating a variable
(COUNT) that stores the number of cells to be added and putting it in the
formula as follows, but it only gives me an error message:

ActiveCell.FormulaR1C1 = "=SUM(R[-COUNT]C:R[-1]C)"

I'm sure there's an infinitely easier way to do this. Thanks in advance for
any suggestions!
--
Steve C
 
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
Summing 2 columns cells into a 3rd colums cells Wayne Cadigan Excel Discussion (Misc queries) 1 May 13th 10 08:34 PM
not summing all the cells Alina Roumania Excel Discussion (Misc queries) 2 April 13th 10 09:41 AM
Summing Cells with #N/A Joan NYC Excel Worksheet Functions 8 February 26th 07 07:57 AM
Summing some cells Jim Excel Worksheet Functions 1 February 17th 05 03:06 AM
Finding cells and summing variable cells Chris M.[_3_] Excel Programming 3 August 21st 03 09:13 PM


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