Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Help with sums

I have a spreadsheet with dates as the column headers. My macro searches for
the first date that is after today and inserts a column to be used for
totals. The formula in the new column needs to sum the values in that row
from column F to the column to the left of the formula. Since the total
column is not always going to be in the same position when my macro runs, I
am not sure how to write the formula.
For example, in row 2, the formula would be =sum(F2:RC[-1]), but I tried
that and a bunch of other stuff that didn't work.

Thanks,
Denise

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with sums


You can find the column of the date in question by something like

Set rng = Sheets("yoursheet").Range("daterange").Find(date)
datecol = date.column

You need to define date as the date you are looking for, and obviousl
have the ranges defined

Then you can use datecol as the maximum column in your sum formul

--
duan

-----------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...fo&userid=1162
View this thread: http://www.excelforum.com/showthread.php?threadid=27596

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Help with sums

You can't mix the A1 and R1C1 reference style like that, but maybe:

dim myCell as range
'some code that sets myCell to something

mycell.FormulaR1C1 = "=sum(RC6:RC[-1])"

(RC6= same row, column 6 (F).)




Denise wrote:

I have a spreadsheet with dates as the column headers. My macro searches for
the first date that is after today and inserts a column to be used for
totals. The formula in the new column needs to sum the values in that row
from column F to the column to the left of the formula. Since the total
column is not always going to be in the same position when my macro runs, I
am not sure how to write the formula.
For example, in row 2, the formula would be =sum(F2:RC[-1]), but I tried
that and a bunch of other stuff that didn't work.

Thanks,
Denise


--

Dave Peterson

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
Sums Jemma Excel Worksheet Functions 6 December 11th 08 06:30 PM
Max sums RPFD531 Excel Discussion (Misc queries) 1 February 24th 08 03:45 AM
sums KELLEE Excel Discussion (Misc queries) 4 February 7th 08 09:49 PM
SUMS Pascale Excel Discussion (Misc queries) 2 January 9th 08 07:55 PM
How to add previous sums in a column to current sums in a column? TD Excel Worksheet Functions 1 September 30th 06 02:55 PM


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