View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ksnapp[_40_] ksnapp[_40_] is offline
external usenet poster
 
Posts: 1
Default help with worksheet functions

hi

i need to implement some of excells more advanced features in my code.
Im starting with averaging. The code I have written is meant to do th
same thing as

{average(if.....

but i need to automate more of the tasks and such

here is the code i have written


Sub average_test()

Dim hope As Long

Range("a2:e2").Select

For Each cell In Selection
If cell = 1 Then
hope = Application.WorksheetFunction.Average(cell.Offset( 1, 0))
End If
Next

MsgBox (hope)

End Sub

it just returns the valve under the last cell in A2:E3 that is = 1.
it doesn't average them all.

help pleas

--
Message posted from http://www.ExcelForum.com