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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 12:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com