views:

24

answers:

1

Hello guys, I have the following problem: in my macro, I select a range and try to locate a number within this selection. The problem is that if the number I am searching is 16 and there is a 160 followed by a 16 in the list, it finds the 160. How do I solve this?? Ideas?

Range("AC7:AK12").Select
Selection.Find(What:=numbe, After:=ActiveCell, LookIn:=xlValues, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate
+1  A: 

Try LookAt:=xlWhole:

Range("AC7:AK12").Select
Selection.Find(What:=numbe, After:=ActiveCell, LookIn:=xlValues, _
    LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate
adrift
edited my answer to include your code, with the change to try (on the 3rd line)
adrift
Thanks, it works!
relima