Using SUM with a custom built range

F

Floyd

One more thing today:

Thanks to everyone's help, I am able to read a cell in as a range
(CounterMarker). Once this cell is in the code, I can create the
following line $CI$9:$C$20 exactly as typed without quotes.

CounterMarker.Offset(-(YearDelta - 1), -1).AddressLocal() & ":" &
CounterMarker.Offset(0, -1).AddressLocal()) -->

When the line is passed into the equation below, it fails to execute.

Any suggestions.


Application.WorksheetFunction.Sum(CounterMarker.Offset(-(YearDelta -
1), -1).AddressLocal() & ":" & CounterMarker.Offset(0,
-1).AddressLocal())


Thanks in advance.

Cheers.
 
T

Tim Williams

dim r as range, blah

set r=range(CounterMarker.Offset(-(YearDelta - 1), -1),
CounterMarker.Offset(0,-1))

blah=Application.WorksheetFunction.Sum(r)



Tim.
 
F

floydbates

Mr. Williams,

Thank you.

I will make the necessary changes to my code first thing in the
morning.

Cheers.

Floyd
 

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

Top