Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry if this question seems trivial, but for the life of me, I can'
figure out how to search for something within a string. Say I got str1="ABC" and str2="AAA AAB AAC ABC ABC" I want to be able to search str2 and see if str1 exists within it. Thanks in advanced -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
H
Try str1 = "ABc str2 = "AAA AAB AAC ABC ABC MsgBox InStr(1, str2, str1, 1 Ton ----- Gaston wrote: ---- Sorry if this question seems trivial, but for the life of me, I can' figure out how to search for something within a string Say I got str1="ABC" and str2="AAA AAB AAC ABC ABC I want to be able to search str2 and see if str1 exists within it. Thanks in advanced -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If Instr(str2, str1)0 then msgbox "found"
Robin Hammond www.enhanceddatasystems.com "Gaston " wrote in message ... Sorry if this question seems trivial, but for the life of me, I can't figure out how to search for something within a string. Say I got str1="ABC" and str2="AAA AAB AAC ABC ABC" I want to be able to search str2 and see if str1 exists within it. Thanks in advanced. --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim str2 as string
dim str1 as string dim iplace as integer dim start as integer start = 1 iplace = InStr(start,str2,str1) if iplace = 0 then 'not found else ' iplace is set the the beginning of the in str2 ' where str1 is located end if -----Original Message----- Sorry if this question seems trivial, but for the life of me, I can't figure out how to search for something within a string. Say I got str1="ABC" and str2="AAA AAB AAC ABC ABC" I want to be able to search str2 and see if str1 exists within it. Thanks in advanced. --- Message posted from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding the cell with a specified string | Excel Worksheet Functions | |||
finding a name in a string | Excel Worksheet Functions | |||
finding what numbers are in a string (Day 2) | Excel Worksheet Functions | |||
finding what numbers are in a string | Excel Worksheet Functions | |||
Finding a string | Excel Programming |