Function NumOnly(txt As String) As String
Dim oMatches As Object
With CreateObject("VBScript.RegExp")
.Pattern = "\d+"
Set oMatches = .Execute(txt)
If oMatches.Count Then
NumOnly = oMatches(0).Value
Else
NumOnly = "Not found"
End If
End With
End Function
Function NumOnly(txt As String) As String
Dim regex As Object, currMatches
Set regex = CreateObject("VBScript.RegExp")
With regex
.Pattern = "\d+"
.Global = True
End With
Set currMatches = regex.Execute(txt)
NumOnly = ""
If currMatches.Count > 0 Then
NumOnly = currMatches(0)
End If
End Function