Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
search a string withing a string : find / search hangs
hi, i want to know if a string is within another string. If i us find/search, the function hangs if the string is not found.....instea of return an "not found code", as i expected... So which function to use to find a string in another one? Regards, iTarna -- itarna ----------------------------------------------------------------------- itarnak's Profile: http://www.excelforum.com/member.php...fo&userid=2786 View this thread: http://www.excelforum.com/showthread.php?threadid=47873 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
search a string withing a string : find / search hangs
Hi Itarnak,
Look at the InStr function in VBA help. --- Regards, Norman "itarnak" wrote in message ... hi, i want to know if a string is within another string. If i use find/search, the function hangs if the string is not found.....instead of return an "not found code", as i expected... So which function to use to find a string in another one? Regards, iTarnak -- itarnak ------------------------------------------------------------------------ itarnak's Profile: http://www.excelforum.com/member.php...o&userid=27865 View this thread: http://www.excelforum.com/showthread...hreadid=478738 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
search a string withing a string : find / search hangs
i have forgotten to say: the strings are not in cells.values: they are in hyperlinks (hyperlink.address -- itarna ----------------------------------------------------------------------- itarnak's Profile: http://www.excelforum.com/member.php...fo&userid=2786 View this thread: http://www.excelforum.com/showthread.php?threadid=47873 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
search a string withing a string : find / search hangs
That works great Function searchStr(searchedStr, otherStr) On Error GoTo errorHandler indice = Application.WorksheetFunction.Find(searchedStr, otherStr) searchStr = indice Exit Function errorHandler: On Error GoTo 0 searchStr = -1 End Functio -- itarna ----------------------------------------------------------------------- itarnak's Profile: http://www.excelforum.com/member.php...fo&userid=2786 View this thread: http://www.excelforum.com/showthread.php?threadid=47873 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
search a string withing a string : find / search hangs
that would be one of the slower ways to do it:
Function searchStr(searchedStr, otherStr) On Error GoTo errorHandler indice = Instr(1,searchedStr, otherStr,vbTextCompare) searchStr = indice Exit Function errorHandler: On Error GoTo 0 searchStr = -1 End Function if you want it to be case sensitive like FIND ("A" < "a"), then change vbTextCompare to vbBinaryCompare or just call instr directly instead of reinventing the wheel. -- Regards, Tom Ogilvy "itarnak" wrote in message ... That works great Function searchStr(searchedStr, otherStr) On Error GoTo errorHandler indice = Application.WorksheetFunction.Find(searchedStr, otherStr) searchStr = indice Exit Function errorHandler: On Error GoTo 0 searchStr = -1 End Function -- itarnak ------------------------------------------------------------------------ itarnak's Profile: http://www.excelforum.com/member.php...o&userid=27865 View this thread: http://www.excelforum.com/showthread...hreadid=478738 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find specific info using search string using VBA | Excel Discussion (Misc queries) | |||
Search/Match/Find ANY part of string to ANY part of Cell Value | Excel Worksheet Functions | |||
FIND / SEARCH text compare cell to string in 3rd cell | Excel Discussion (Misc queries) | |||
to search for a string and affect data if it finds the string? | Excel Worksheet Functions | |||
VBA function : How to search a string in another string? | Excel Programming |