Trouble with Extract Number from a string

42 Views Asked by At

The decimal point is being removed in the ExtractNumber. I cannot determine cause.

IE: .25MP returns 25 and not .25

Public Function ExtractNumber(inValue As String) As Variant
With New RegExp
.Pattern = "(\d{1,3},?)+(\.\d{2})?"
.Global = True
If .test(inValue) Then
ExtractNumber = CDec(.Execute(inValue)(0))
dNumericFromRange = ExtractNumber
End If
End With
End Function

Have tried...

ExtractNumber = CDbl(.Execute(inValue)(0))
ExtractNumber = CVar(.Execute(inValue)(0))
0

There are 0 best solutions below