How do I test if a cell has any of the special characters e.g. *,?,/
Thanks for any help.
How do I test if a cell has any of the special characters e.g. *,?,/
Thanks for any help.
Try:
Function CellHasSpecChar(c As Range) As Boolean
CellHasSpecChar = c.Value Like "*[?/*]*"
End Function
Sub TestIt()
MsgBox CellHasSpecChar(ActiveCell)
End Sub
Regards,
Greg
"linglc" wrote:
> How do I test if a cell has any of the special characters e.g. *,?,/
> Thanks for any help.
For ? and / you can use
=ISNUMBER(FIND("/",A2)) etc..
For *, best to use
=ISNUMBER(FIND(CHAR(42),A2))
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"linglc" <[email protected]> wrote in message
news:[email protected]...
> How do I test if a cell has any of the special characters e.g. *,?,/
> Thanks for any help.
If you want the test all in one, try
=SUMPRODUCT(--(ISNUMBER(FIND({"*","/","?"},A1))))>0
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"linglc" <[email protected]> wrote in message
news:[email protected]...
> How do I test if a cell has any of the special characters e.g. *,?,/
> Thanks for any help.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks