View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] ucanalways@gmail.com is offline
external usenet poster
 
Posts: 115
Default Sum macro for a variable "i" in a loop

I am trying to do the following sum macro but I get an error for the
sum fomula. I want to sum the values from range B2 to B&i, the
corresponding value of "i".. Please let me know how do I do this.
Thanks

Sub test()
Dim i As Integer
For i = 1 To 100
Range("A1").Value = Sum(Range(B2, B&i))
Next i
End Sub