Excel VBA - Check if cell contains specific characters

I'm using the following to check if a cell contains any invalid characters.

If Target Like "*[\!%^:~#|@.;`\/*$,]*" Then

This works fine and return the correct error message.

I'd like to add Double Quotes " to the check, but when I add " I get errors.

How do I do this ?

Thanks


Solution 1:

Doubling the quotes should do it:

Like "*[\!%^:~#|@.;`\/*$,""]*"  

Note that \ is the LIKE escape char, so "\!" means in fact "!".

Test:

a = "abc""de"
? a
abc"de
? a like "*[b]*"
True
? a like "*[""]*"
True