View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Loop to determine number of rows range

Sub Loop()

Dim i As Integer
i = Range("A1").CurrentRegion.Rows.Count
Range("C2").Resize(i).FormulaR1C1 = "=Average(RC[-1],RC[-2])"
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

wrote in message
s.com...
Can anybody tell me why macro is not looping to last cell in row of
column c - pls correct my macro. Thxs

Sub Loop()

Dim i As Integer
For i = 1 To Range("A1").CurrentRegion.Rows.Count - 1
Range("C2").FormulaR1C1 = "=Average(RC[-1],RC[-2])"
Range("C2").Offset(1, 0).Select
Next i
End Sub