Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Check whether text in cell contains "?"

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default Check whether text in cell contains "?"

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

"H@C0" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Check whether text in cell contains "?"

Thanks for your help.
This was exactly what I was looking for.
Hans

On Sat, 30 Aug 2008 12:49:00 -0700, JLatham <HelpFrom @
Jlathamsite.com.(removethis) wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine text from multiple cells into one cell - =(A1&","&A2","&A3 mh Excel Worksheet Functions 5 July 27th 09 02:40 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
how excel checks a "#" to express it as a text, check if cell is n kbee Excel Worksheet Functions 3 February 15th 08 05:25 AM
Excel: Changing "numeric $" to "text $" in a different cell. Heather_CCF Excel Worksheet Functions 1 September 5th 06 06:06 PM
create links to check boxes marked "good" fair"and "bad" pjb Excel Worksheet Functions 3 April 20th 06 02:17 AM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"