Not Like????

melewie

Board Regular
Joined
Nov 21, 2008
Messages
188
Office Version
  1. 365
Platform
  1. Windows
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>
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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
 
Upvote 0
Assuming you are using Like in an If..Then construct, you could just add your proessing code to the Else part.
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,536
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top