View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default substring matching functions (need a hand please)

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"
wrote in message
news:Ciccio_Drink.22hxmz_1138706101.8006@excelforu m-nospam.com...

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 not
present in another string.

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

sorry for the newbie question and thx all


--
Ciccio_Drink
------------------------------------------------------------------------
Ciccio_Drink's Profile:
http://www.excelforum.com/member.php...o&userid=31003
View this thread: http://www.excelforum.com/showthread...hreadid=506710