View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] pfsardella@yahoo.com.nospam is offline
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.