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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

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.
 

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
 

pgc01

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

You could also use a CharList:

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

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
 

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,510
Messages
5,832,169
Members
430,114
Latest member
kefier

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