Speed - or lack of it

D

Don Bowyer

I have a range of 5 columns 2000 rows long.
I need to look up one specific date in the 1st column.
Is it faster to use ".Find" or " For Each...Next".
I will not ".Select" the found item.
Any advice much appreciated.
Don
 
T

Tushar Mehta

While I suspect the Find method will be faster, it might be easiest if
you checked the performance of the two options yourself.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
T

Tom Ogilvy

Find would be faster, but it often has trouble with finding dates. I would
use application.Match

Dim res as Variant, rng as Range, myDate as Date
With Worksheets("Data")
set rng = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
End With
myDate = #12/23/2004#
res = Application.Match(clng(myDate),rng,0)
if not iserror(res) then
msgbox "Found in cell " & rng(res).Address
Else
msgbox "Not found"
End if
 
Top