Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcard operators to use with LIKE
Im using LIKE to determine if a cell contains certain text, but I dont know
how to use the wildcard characters or how to structure a pattern to make the search effective. I want to find any cell with the text traf10 in it not necessarily being that string the only content of the cell. If Cell2Srch.Value Like "traf10" And Not Cell2Srch.Value Like "traf106" Then Cells(Cell2Srch.Row, 1).Value = "Yes" End If Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcard operators to use with LIKE
Hi,
Try this alternative to like If InStr(cell2srch, "traf10") And Not InStr(cell2srch, "traf106") Then Cells(cell2srch.Row, 1).Value = "Yes" Mike "LuisE" wrote: Im using LIKE to determine if a cell contains certain text, but I dont know how to use the wildcard characters or how to structure a pattern to make the search effective. I want to find any cell with the text traf10 in it not necessarily being that string the only content of the cell. If Cell2Srch.Value Like "traf10" And Not Cell2Srch.Value Like "traf106" Then Cells(Cell2Srch.Row, 1).Value = "Yes" End If Thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcard operators to use with LIKE
I think the wild cards would make it look like this:
If Cell2Srch.Value Like "*traf10*" And Not Cell2Srch.Value Like "*traf106*" Then Cells(Cell2Srch.Row, 1).Value = "Yes" End If Tom |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcard operators to use with LIKE
This should do the same thing PROVIDED there is always at least one
character following the 'traf10' characters... If Cell2Srch.Value Like "*traf10[!6]*" Then -- Rick (MVP - Excel) "TomPl" wrote in message ... I think the wild cards would make it look like this: If Cell2Srch.Value Like "*traf10*" And Not Cell2Srch.Value Like "*traf106*" Then Cells(Cell2Srch.Row, 1).Value = "Yes" End If Tom |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcard operators to use with LIKE
I guess this version will work properly even if there is no character
following the 'traf10' characters... If Cell2Srch.Value & " " Like "*traf10[!6]*" Then -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... This should do the same thing PROVIDED there is always at least one character following the 'traf10' characters... If Cell2Srch.Value Like "*traf10[!6]*" Then -- Rick (MVP - Excel) "TomPl" wrote in message ... I think the wild cards would make it look like this: If Cell2Srch.Value Like "*traf10*" And Not Cell2Srch.Value Like "*traf106*" Then Cells(Cell2Srch.Row, 1).Value = "Yes" End If Tom |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using Or and And Operators | Excel Programming | |||
combining operators | Excel Programming | |||
Operators/if etc | Excel Programming | |||
Comparison Operators | Excel Programming | |||
Unary operators | Excel Worksheet Functions |