Speed - or lack of it

  • Thread starter Thread starter Don Bowyer
  • Start date Start date
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top