View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Finding exact date

Hi,
When using Range.Find, some of the parameters of the Find method, if not
explicitely used, keep their values from the previous use of FInd (even from
the user doing EditFind). See online doc:
"The settings for LookIn, LookAt, SearchOrder, and MatchByte are saved each
time you use this method. If you dont specify values for these arguments the
next time you call the method, the saved values are used"

In your case, it seems like the Find is looking at the part of the cell
while you want it to match the whole cell. That is, try using the
parameter/value:
LookAt:=xlWhole

(also check the other parameters eg: Lookin,...)
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
<http://www.ready-reports.com


"Alex" wrote:

I am using the following line of code to find a date formatted cell in range
b3:ab300 that matches the content of the date formatted cell in H8 in the
worksheet "Import Macros". The problem that the date 1/1/08 is coming up as
a match to the cell containing 11/1/08 and 2/1/08 shows as matching 12/1/08.
How can I change it to an exact date match? Thanks much.

Set FoundCell = .Range("b3:ab300").Find(what:=Worksheets("Import
Macros").Range("h8").Value)