Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default substring matching functions (need a hand please)


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

--
Ciccio_Drin
-----------------------------------------------------------------------
Ciccio_Drink's Profile: http://www.excelforum.com/member.php...fo&userid=3100
View this thread: http://www.excelforum.com/showthread.php?threadid=50671

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default substring matching functions (need a hand please)

Hi Ciccio_Drink,

To see the message, replace "xhorse" with "horse"

---
Regards,
Norman



"Norman Jones" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default substring matching functions (need a hand please)


I just found the answer

function InStr ( "String1", "String2" )


--
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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default substring matching functions (need a hand please)


thank you very much Norman,

Cicci

--
Ciccio_Drin
-----------------------------------------------------------------------
Ciccio_Drink's Profile: http://www.excelforum.com/member.php...fo&userid=3100
View this thread: http://www.excelforum.com/showthread.php?threadid=50671

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
INDEX AND MATCHING FUNCTIONS Jeanette Excel Worksheet Functions 5 September 21st 09 09:23 PM
matching or lookup functions anand Excel Worksheet Functions 3 February 21st 09 05:08 PM
Index & Matching Functions Erik Sauceda via OfficeKB.com Excel Discussion (Misc queries) 5 June 13th 05 11:46 PM
y-axis moves from the left hand side to the right hand side JP Excel Discussion (Misc queries) 1 March 13th 05 04:43 PM
y-axis moves from the left hand side to the right hand side! JP Charts and Charting in Excel 1 March 11th 05 12:29 AM


All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"