ianfrancis56
New Member
- Joined
- Aug 10, 2011
- Messages
- 34
Hi all,
I'm a little fried and I cannot figure out why this won't work, although I have a suspicion it has to do with the Range the Average function is being applied to.
Is Sheet 1 Columns B and C (starting in Row 2) are values. I want to look at the Average value of each column as it moves down (ie Average of values in cells B2 to the end, then with B3 being the first cell in the calculation, etc...). Appreciate any help, thanks!
I'm a little fried and I cannot figure out why this won't work, although I have a suspicion it has to do with the Range the Average function is being applied to.
Code:
Sub Returns()
Dim z@, y@, x@
With Sheets(1)
For z = 2 To 3
For x = 2 To y = .Cells(2, z).End(xlDown).Row
.Cells(x, z + 2) = .Application.Average( _
.Range(.Cells(x, z).End(xlDown).Row))
Next x
Next z
End With
End Sub
Is Sheet 1 Columns B and C (starting in Row 2) are values. I want to look at the Average value of each column as it moves down (ie Average of values in cells B2 to the end, then with B3 being the first cell in the calculation, etc...). Appreciate any help, thanks!