Check whether text in cell contains "?"

  • Thread starter Thread starter H@C0
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top