Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Newbie question: function call


If dhBinarySearch(varItems, varSought) = -1 then
does something here
else
does something else here
end if

would be the way you would use Mr Getz's function.

--
Regards,
Tom Ogilvy


"wachen" wrote in message
om...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Question Terri[_2_] New Users to Excel 8 February 23rd 08 12:21 AM
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
If Then Question from Newbie. . . hospitalgreg Excel Discussion (Misc queries) 6 October 16th 06 08:16 PM
Newbie Question, NOW() function justin4480 Excel Worksheet Functions 3 May 29th 06 10:31 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM


All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"