Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I find only number caracter in a string? | Excel Worksheet Functions | |||
Find a phrase in a string and convert it to a number | Excel Worksheet Functions | |||
find % number from text string | Excel Discussion (Misc queries) | |||
find last number in a string? | Excel Discussion (Misc queries) | |||
find position of a number in a string | Excel Worksheet Functions |