Sum up

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

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.
 
set rng = Range(cells(26,myrange(i).column),myrange(i).offset(-1,0))
myRange(i).Value = Application.Sum(rng)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top