AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,835
- Office Version
- 2019
- 2016
- Platform
- Windows
I have this routine which I've used for a while
However I've found it return numbers from loc only up to next non-numeric char.
Is there any way to have it return all numbers in loc ?
VBA Code:
Function NumbersOnly(loc) As String
Dim RE As Object, REMatches As Object
Set RE = CreateObject("vbscript.regexp")
RE.Pattern = "\d+"
If (RE.test(loc) = True) Then
Set REMatches = RE.Execute(loc)
NumbersOnly = REMatches(0)
End If
Set REMatches = Nothing
Set RE = Nothing
End Function
Is there any way to have it return all numbers in loc ?