Using Like with "and" or "or"

Ed in Aus

Well-known Member
Joined
Jul 24, 2007
Messages
829
Hi everyone,

need a little help with a statement failing.

Code:
Cells(r, 1).Select
If ActiveCell.Value Like "*.*" Or "*$*" Then GoTo skippy

the current activecell = "Administration" but it brings back an error run time type 13...

not sure what I have done wrong
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Sal Paradise

Well-known Member
Joined
Oct 23, 2006
Messages
2,457
Rich (BB code):
If ActiveCell.Value Like "*.*" Or ActiveCell.Value Like "*$*" Then GoTo skippy
Try that.
 
Upvote 0

Ed in Aus

Well-known Member
Joined
Jul 24, 2007
Messages
829
Bingo, thank you so much tried to google but it let me down this time... was much quicker to come in here for a change... usually find what I need out there.

Thanks again
 
Upvote 0

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,895
Hi Ed

You could also use a CharList:

Code:
If ActiveCell.Value Like "*[.$]*" Then GoTo skippy
 
Upvote 0

Ed in Aus

Well-known Member
Joined
Jul 24, 2007
Messages
829
ADVERTISEMENT
Thanks for that PGC can you explain what it is doing when you enter this just so I can use it for different scenarios not sure I follow what is happenening
 
Upvote 0

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,895
Hi again

You build a CharList by enclosing characters in square brackets. The pattern will mach any one of the characters in the CharList.

Ex:

"*[.$%_]*"

will match any string that includes any of the characters ".", "$", "%" or "_".

HTH
 
Upvote 0

Forum statistics

Threads
1,196,019
Messages
6,012,898
Members
441,738
Latest member
dataexcel

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
Top