View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kris_Wright_77 Kris_Wright_77 is offline
external usenet poster
 
Posts: 24
Default Error using WorksheetFunction.Countif

I have been writing some code to evaluate an array of numbers using some
worksheet functions, some of which work and some dont (1 so far)

I have loaded an 1-Dimensional array, (Five_Array), with 5 Numbers and then
used the following functions to evaluate

Var = WorksheetFunction.Var(Five_Array)
Ave = WorksheetFunction.Average(Five_Array)
Largest = WorksheetFunction.Large(Five_Array,1)
all of which work

However using CountIf causes 'Run-Time Error 424' Object Required
Occur = WorksheetFunction.Countif(Five_Array,Five_Array(1) )
If Five Array contains (6,20,2,6,15) then Occur should = 2

Can anyone explain to me why it wont work for CountIf, as it will
undoubtedly occur when I add other Functions at a later date.

Thanks for any help that anyone can give.

Kris