G
Guest
I am trying to create a sum formula that uses two range objects as the input
to the sum formula. For example I have the following ranges dimensioned:
Dim r1 As Range, r2 As Range
Further down in the code have the following lines:
Range("c22").select
Set r1 = Range(ActiveCell.Address)
Range("C40").Select
Set r2 = Range(ActiveCell.Address)
Now I want to do a sum formula using these two ranges. I then go to a blank
cell in code and try to enter this:
= sum(r1.Address:r2.Address)
When i try this it doesn't compile and throws an error that says expected
list seperator or ).
Can someone point me to some documentation or otherwise advise me on how I
should be approaching this problem?
Thank you very much!
JEFF
to the sum formula. For example I have the following ranges dimensioned:
Dim r1 As Range, r2 As Range
Further down in the code have the following lines:
Range("c22").select
Set r1 = Range(ActiveCell.Address)
Range("C40").Select
Set r2 = Range(ActiveCell.Address)
Now I want to do a sum formula using these two ranges. I then go to a blank
cell in code and try to enter this:
= sum(r1.Address:r2.Address)
When i try this it doesn't compile and throws an error that says expected
list seperator or ).
Can someone point me to some documentation or otherwise advise me on how I
should be approaching this problem?
Thank you very much!
JEFF