Hi
Hope it is not too late to way in. There is an easy way to solve your
problem.
In the binary search, instead of using the statement:
If (strArray(lngMiddle) < strSearch) .
Use the statement
If strcomp(strArray(lngMiddle),strSearch,vbTextCompare) & bolInverseOrder <
0 then
(the vbtextcompare will do the same normalization of the strings as the
Excel sort routine)
And
I got 85/85 which you reported was what the long running Find routine gave.
(you can also save a compare per loop by using
Select case strcomp(strArray(lngMiddle),strSearch,vbTextCompare) &
bolInverseOrder
Case =0 : binarysearch = lngmiddle: end function
Case < 0
Lngmiddle = lngMiddle+1
Case > 0
lngMiddle = lngMiddle-1
End select
DAVIDB
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar