Thread
:
Finding a value quickly using VBA
View Single Post
#
1
Posted to microsoft.public.excel.misc
Don Guillett
external usenet poster
Posts: 10,124
Finding a value quickly using VBA
simple one since you have the column
Function fn(x)
On Error GoTo nono:
fn = Columns(2).Find(x, lookat:=xlWhole).Row
nono:
End Function
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"GeorgeJ" wrote in message
...
Lets assume I have a column of numbers sorted in ascending order. Suppose
these numbers occupy the range B1:B1000. Suppose I want VBA code for
Function FindNum(Num as Long) as Long
[code]
End Function
which returns 0 if Num is not in column B and if it is returns the first
row
in which Num is located. I realize I could write a loop to do this but
is
there a faster, non-loop method? What about the case in which the numbers
in
col B are not sorted?
Thanks
--
-regards
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett