View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wachen wachen is offline
external usenet poster
 
Posts: 2
Default Newbie question: function call

I am using a function to do binary search of an array. I got the code
from a refence book. The function is,

dhBinarySearch(varItems as Variant, varSought as Variant) As Long
The return value is -1 if varSought not found or the position of
varSought in the array.

In my sub, I have the following code

Call dhBinarySearch(varItems, varSought)

If dhBinarySearch = -1 then
does something here
else
does something else here
end if

When I tried to run it, an error box pops up that says
Compile error:
Argument not optional

and highlights the word dhBinarySearch in the If statement

Can anyone help?

Thanks

Warren