Not Like????

melewie

Board Regular
Joined
Nov 21, 2008
Messages
185
Hi all,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
I am trying to create and loop that will identify if a cell does not contain "MX". I have created several before to find if a cell does contain certain characters<o:p></o:p>
Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Cells(RowNo, 2).Value Like "*" & "MX" & "*" Then<o:p></o:p>[/FONT][/COLOR]
<o:p></o:p>
<o:p></o:p>
But I can’t seem to get does not contain to work.<o:p></o:p>
<o:p></o:p>
Any help would be great.<o:p></o:p>
<o:p></o:p>
Thanks<o:p></o:p>
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Hi

You can use Like eg:

Code:
 If Not cell.Value Like "*MW*" Then
But it would be better in my opinion to use Instr:

Code:
If Instr(1,cell.Value,"MW")=0 Then  'cell doesn't contain MW
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,370
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
Assuming you are using Like in an If..Then construct, you could just add your proessing code to the Else part.
 

Forum statistics

Threads
1,082,438
Messages
5,365,531
Members
400,837
Latest member
ELMST616

Some videos you may like

This Week's Hot Topics

Top