#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Sum up

Hi ... here's a simple question, I'm sure.

In a For Next loop, I need to have myRange(i) set to be
the sum of the cell above it up until row 26. How should
I write the line of code for this? A sample of the data
is below. Thanks, Mike.


A B C D
1 2 3 4 <== This would be row 26
3 1 4 1
.. . . .
.. . . .
.. . . .
4 3 1 1
2 2 4 3
13 8 12 9 <== sum will go in this row.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sum up

set rng = Range(cells(26,myrange(i).column),myrange(i).offse t(-1,0))
myRange(i).Value = Application.Sum(rng)

--
Regards,
Tom Ogilvy

Mike wrote in message
...
Hi ... here's a simple question, I'm sure.

In a For Next loop, I need to have myRange(i) set to be
the sum of the cell above it up until row 26. How should
I write the line of code for this? A sample of the data
is below. Thanks, Mike.


A B C D
1 2 3 4 <== This would be row 26
3 1 4 1
. . . .
. . . .
. . . .
4 3 1 1
2 2 4 3
13 8 12 9 <== sum will go in this row.



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



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

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"