Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Find any number within string

I need a line of code that will tell me if there is any numeric character within a string of text in a cell. The number could be
anywhere within the string, or there might not be any numbers in the string at all. I just need a true or false on this. Any
suggestions?

Thanks in advance.
--
RMC,CPA



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Find any number within string


Sub TestMe()
Dim bBo As Boolean

bBo = Alpha(Range("A1"))

End Sub

Function Alpha(rngR As Range) As Boolean
'' Does string contain numerics?

Dim intI As Integer

For intI = 1 To Len(rngR.Value)
If Mid(rngR.Value, intI, 1) Like "*[0-9]*" Then _
Alpha = True: Exit Function
Next intI

End Function


HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

I need a line of code that will tell me if there is any numeric character within a string of text in a cell. The number could be
anywhere within the string, or there might not be any numbers in the string at all. I just need a true or false on this. Any
suggestions?

Thanks in advance.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Find any number within string

Hi R,

Try:

If ActiveCell.Value Like "*[0-9]*" Then 'contains a numeric character


---
Regards,
Norman



"R. Choate" wrote in message
...
I need a line of code that will tell me if there is any numeric character
within a string of text in a cell. The number could be
anywhere within the string, or there might not be any numbers in the
string at all. I just need a true or false on this. Any
suggestions?

Thanks in advance.
--
RMC,CPA





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Find any number within string

Thanks Norman ! I knew it was something like that but my memory just went blank.
--
RMC,CPA


"Norman Jones" wrote in message ...
Hi R,

Try:

If ActiveCell.Value Like "*[0-9]*" Then 'contains a numeric character


---
Regards,
Norman



"R. Choate" wrote in message
...
I need a line of code that will tell me if there is any numeric character
within a string of text in a cell. The number could be
anywhere within the string, or there might not be any numbers in the
string at all. I just need a true or false on this. Any
suggestions?

Thanks in advance.
--
RMC,CPA






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
How do I find only number caracter in a string? alegrandi Excel Worksheet Functions 1 April 3rd 09 05:43 PM
Find a phrase in a string and convert it to a number X-Ray Excel Worksheet Functions 5 October 8th 08 03:24 PM
find % number from text string natek1234 Excel Discussion (Misc queries) 4 September 18th 07 01:40 AM
find last number in a string? Steve Excel Discussion (Misc queries) 3 June 12th 07 03:56 PM
find position of a number in a string fullers80 Excel Worksheet Functions 1 September 6th 05 03:47 PM


All times are GMT +1. The time now is 11:34 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"