Thread: Find Function
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default Find Function

Change xlPart to xlWhole.

Hope this helps,

Hutch

"RigasMinho" wrote:

All right i have a problem.

Say I have a column with cells of:
D
B,DA
F,AD
D,AD

Currently the code below finds all the values of anything with the
letter "D" in it. I only want it to find values where it is just "D".

so finding cell with D,AD is fine because it has D in it.

But finding cell with F,AD is not fine. Which it currently finds
because it has a "D" in the part of "AD"

Any ideas? I was thinking about parse each cell but i think that would
take too long and be lengthy.

Set rngFound = rngToSearch.Find(What:=("D"), _
LookIn:=xlValues, _
LookAt:=xlPart, _
MatchCase:=True)

Any Ideas?