Retreiving only numeric values from a string
Hi Alex,
Try posting the following user defined
function into a standard module:
'=============
Public Function NumberOnly( _
sStr As String) As Variant
Dim oRegExp As Object
Application.Volatile
Set oRegExp = CreateObject("VBScript.RegExp")
With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "/d"
NumberOnly = .Replace(sStr, vbNullString)
If IsNumeric(NumberOnly) Then _
NumberOnly = CDbl(NumberOnly)
End With
End Function
'<<=============
With the data of interest in A1:A10.
enter:
=NumberOnly(A1)
in B1 and drag the formula down to B10.
---
Regards.
Norman
"Alex" wrote in message
...
There are two parts I am trying to accomplish for a set of data I have in
column A.
What I have Results I would like
A1:kkdd55dd B1:55
A2:eaa5788ee B2:5788
A3:sfse B3:455
A4:
A5:
A6:455dae
If possible I wanted to have a function where it would Search at a range
from A1:A10 and place the first set of numbers it found (always be
together)
in B1, the second set of numbers it finds placed in B2 and so on. As a
reminder I cannot download any type of files if that is to be suggested.
-thank you
|