Extracting a number in a text string
Hi Pogo,
try this module and use
=digitsonly(a1)
***********************************
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object
Set oRegExp = CreateObject("VBScript.RegExp")
With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"
DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
*********************************************
hth
regards from Brazil
Marcelo
"Pogo" escreveu:
I need to extract a number from a text string. For example, Cryo Technician
$100.00. I want to extract the $100 rate and use it in another function,
i.e., Rate x hours.
I hope I made myself clear. Thanks in advance.
|