Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Loop to determine number of rows range

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I determine which data in a range add up to a fixed number? Mray Excel Worksheet Functions 5 May 27th 10 09:04 PM
sumproduct, multiple if, some same cell, determine number of rows Tim Excel Worksheet Functions 4 March 26th 09 08:57 AM
Insert Variable Number of Rows; With Loop ryguy7272 Excel Worksheet Functions 2 December 27th 06 08:25 PM
Determine number of rows meeting a condition Snapps Excel Discussion (Misc queries) 4 November 2nd 06 08:40 PM
Formula to determine whether number falls within range?? Cat Excel Worksheet Functions 4 September 17th 05 03:01 AM


All times are GMT +1. The time now is 09:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"