Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Search within a single cell for a character

Using VBA I want an If/Then statement to search within a single cell (D59) to
find if the ":" (colon character) exists after the fourth character. If not
"Then: Wrong = True"

In an adjacent worksheet cell I could just enter =iserr(find(":",D59,4)) and
if the result is True then I know it doesn't exist.

How do I write this in VBA?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Search within a single cell for a character

If Instr(5, Range("D59"), ":") 0 then Wrong = True

"AZSteve" wrote:

Using VBA I want an If/Then statement to search within a single cell (D59) to
find if the ":" (colon character) exists after the fourth character. If not
"Then: Wrong = True"

In an adjacent worksheet cell I could just enter =iserr(find(":",D59,4)) and
if the result is True then I know it doesn't exist.

How do I write this in VBA?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Search within a single cell for a character

Dang, I really need to learn to read the details more carefully before
posting my reply. This actually should have been:

If InStr(5, Range("D59"), ":") = 0 Then Wrong = True

or

If Not InStr(5, Range("D59"), ":") 0 Then Wrong = True

but you probably got the idea anyhow...


"B Lynn B" wrote:

If InStr(5, Range("D59"), ":") 0 then Wrong = True

"AZSteve" wrote:

Using VBA I want an If/Then statement to search within a single cell (D59) to
find if the ":" (colon character) exists after the fourth character. If not
"Then: Wrong = True"

In an adjacent worksheet cell I could just enter =iserr(find(":",D59,4)) and
if the result is True then I know it doesn't exist.

How do I write this in VBA?

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
replace a single character WITH FORMAT in a cell ela Excel Worksheet Functions 9 February 24th 10 03:30 AM
Character Search a cell JPS Excel Worksheet Functions 8 March 17th 08 08:21 AM
Limit the input in a cell to a single character elevinson Excel Programming 3 November 2nd 07 08:38 PM
How do I perfom a character count in a single cell in Excel? RonNette72791 New Users to Excel 1 August 11th 06 05:49 PM
Case sensitive and single character in cell praveen_khm[_22_] Excel Programming 0 February 7th 06 02:21 PM


All times are GMT +1. The time now is 05:16 PM.

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

About Us

"It's about Microsoft Excel"