How do I test if a cell has any of the special characters e.g. *,?,/ Thanks for any help.
L linglc Jul 26, 2006 #1 How do I test if a cell has any of the special characters e.g. *,?,/ Thanks for any help.
G Greg Wilson Jul 26, 2006 #2 Try: Function CellHasSpecChar(c As Range) As Boolean CellHasSpecChar = c.Value Like "*[?/*]*" End Function Sub TestIt() MsgBox CellHasSpecChar(ActiveCell) End Sub Regards, Greg
Try: Function CellHasSpecChar(c As Range) As Boolean CellHasSpecChar = c.Value Like "*[?/*]*" End Function Sub TestIt() MsgBox CellHasSpecChar(ActiveCell) End Sub Regards, Greg
B Bob Phillips Jul 26, 2006 #3 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)
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)
B Bob Phillips Jul 26, 2006 #4 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)
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)