Regex exception
Does it have to be a RegEx? What about a test something like this...
If Not TextValue Like "*[!a-zA-Z.-]*" And Right(TextValue, 3) < "FAO" Then
MsgBox "Looks like a valid name to me"
Else
MsgBox "That name is not valid"
End If
--
Rick (MVP - Excel)
"Geoff K" wrote in message
...
Hi
Should be easy but I can't work out the expression to raise an exception
to
the string or sub string FAO
This doesn't work [a-zA-Z\-\.]\s?|(?!)FAO
A cell might acceptably contain
Name or
Name-Name or
Name - Name or
. (dot)
but in error may contain
Name FAO or
Name-Name FAO or
Name - Name FAO or just
FAO
How can I prevent FAO from making a match?
Geoff
|