Check whether text in rCell2 is contained in rCell1, equivalent to =SUBSTITUTE(A1,B1,"")<>A1

Function HasText(rCell1 As Range, rCell2 As Range) As Boolean
 If Application.WorksheetFunction.Substitute(rCell1.Value, rCell2.Value, "") <> rCell1.Value Then HasText = True
End Function

or

Function HasText2(rCell1 As Range, rCell2 As Range) As Boolean
 HasText2 = rCell1.Value Like "*" & rCell2.Value & "*"
End Function


© Copyright andrewsexceltips.net All Rights Reserved.