View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey ExcelMonkey is offline
external usenet poster
 
Posts: 553
Default Instr() with multiple search terms

I it possible to use the Instr() function with multiple search terms. The
idea being that all below should return a value fo 1

Dim Y as Double

Y = Instr(1, "Hello World", "Hello|"The"|"Dog")
Y = Instr(1, "The World", "Hello|"The"|"Dog")
Y = Instr(1, "Dog World", "Hello|"The"|"Dog")

The idea here being to find matches at the beginning of the Target String.

Alternatively I could use Regular Expressions. But I cannot remember how to
use the Match functionality to return the position of the word.

Thanks

EM