View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mdalamers via OfficeKB.com mdalamers via OfficeKB.com is offline
external usenet poster
 
Posts: 7
Default Adding Rabges without for each loops

Hi,

I should like to add the cells in two ranges WITHOUT having to loop through
each range separately.
Suppose the cells A1 to A5 in my worksheet are filled, as well as cells B1 to
B5

Now I thought this would do the trick. But apparently not:
Sub AddRanges()
Dim r1 As Range
Dim r2 As Range
Dim r3 As Range

Set r1 = Range("a1:a5")
Set r2 = Range("b1:b5")
Set r3 = Range("c1:c5")

r3.value = r1.value + r2.value
End Sub

Any suggestions?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1