Thread
:
Instr() with multiple search terms
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Instr() with multiple search terms
As far as I remember, you would have to use an if or select case
Sub ins()
If InStr(1, "Hello World", "Hello") = 1 Or _
InStr(1, "Hello World", "dog") = 1 Then y = 1
MsgBox y
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"ExcelMonkey" wrote in message
...
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
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett