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:

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

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,881
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,881
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,599
Messages
5,597,105
Members
414,125
Latest member
iQQ

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