View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default InStr function question

nevermind, i see what you did. Thanks for learning us yokels Tom. =)
--
When you lose your mind, you free your life.


"ben" wrote:

Tom,
Wouldn't that last instr function still cause it to find ",22" or
",234443" ?

--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

sStr = "11,22,33"
if instr(1,sStr,",2,") or instr(1,sStr,"2,") = 1 or instr(1,sStr,",2") =
len(sStr)-1 then

--
Regards,
Tom Ogilvy


wrote in message
oups.com...

I am using Excel 2002

I have this problem with Instr. Imagine a cell that contains the
following text

11,22,33

If I use the following command, instr(1,activecell.Value,"2",0)

The function returns a 4.

But, what if I wanted to function to look for exactly a 2? Because 2 is
part of 22. The function found it.

Is there a better function that will help me find exactly what I am
looking for ?