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 |
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 |
All times are GMT +1. The time now is 06:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com