Thread: InStr Question
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norm Lundquist Norm Lundquist is offline
external usenet poster
 
Posts: 18
Default InStr Question

Tom,

But why does the first example return 6 for the "P" when it is actually the
9th character? I must REALLY be missing something!

Norm

"Tom Ogilvy" wrote:

It returns the position from the start of the string, not relative to where
you start searching.

--
Regards,
Tom Ogilvy


"Norm Lundquist" wrote:

Here's an easy one that I can't see!

Why does

InStr(4,"XXpXXpXXPXXP","P",vbTextCompare)

return 6 and

Instr(5,"ABC-123-XYZ","-",vbTextCompare)

return 8??? I thought the second one would return 4 because the second dash
is the fourth character when you start search at position 5.

THANKS!