Check whether text in cell contains "?"

H

H@C0

Hi,
How can I check with a macro script if the text in a cell contains a
question mark?
Thanks in advance for any tip or hint.
Hans
 
J

JLatham

Use the InStr() function. Example below will tell you if there's a ? in the
text in cell A1 of the active sheet.

Sub HasQuestionMark()
If InStr(Range("A1"), "?") Then
MsgBox "Found question mark"
Else
MsgBox "No question mark here!"
End If
End Sub
 
Top