substring matching functions (need a hand please)

C

Ciccio_Drink

Hi all, I am a very new Excel macro functions user.

I was looking for a function able to check if a substring is or no
present in another string.

i.e. if the string "--------AB-------" contains the string "AB"

sorry for the newbie question and thx al
 
N

Norman Jones

Hi Ciccio_Drink,

Look at the InStr function in VBA help:

'=============>>
Public Sub Tester001()
Dim sStr As String

sStr = " A horse, my Kingdom for a horse"

If InStr(1, sStr, "xhorse", vbTextCompare) > 0 Then _
MsgBox "substring found!"

End Sub
'<<=============


---
Regards,
Norman



"Ciccio_Drink" <[email protected]>
wrote in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top