View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Matthew Dyer Matthew Dyer is offline
external usenet poster
 
Posts: 178
Default 2 dimensional loop, averageif formula

Hey guys, you've been extremely helpful in the recent past and
hopefully your genuis will shine again.

I am trying to run a 2 dimensional loop. starting cell ("lastrw
+2","lastcol-37"), i want to go cell by cell till "lastcol" and fill
each cell with an averageif formula. once 'lastcol' is reached i want
to start over again at 'lastrw+3' and loop again, then the same for
'lastrw+4'. I think i've got they syntax of the loop correct but i'm
struggling with the averageif formula. help? Here's what i've got so
far. I know... it must look a mess.

For i = LastRw + 2 To LastRw + 4
For ii = LastCol - 37 To LastCol
Cells(i, ii).Formula = "=averageif(a1:a" & lastrw & ",b" &i&
",c1:c" &lastcol& ")"
Next ii
Next i