Created
March 12, 2023 14:05
-
-
Save ezhov-da/725f0e5651c9a7d07ac489027776724c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function EXTRACT_CODE(cell) | |
Dim result As String | |
Dim allMatches As Object | |
Dim RE As Object | |
Set RE = CreateObject("vbscript.regexp") | |
RE.Pattern = "[0-9]{6}" | |
RE.Global = True | |
RE.IgnoreCase = True | |
Set allMatches = RE.Execute(cell) | |
If allMatches.Count <> 0 Then | |
result = allMatches.Item(0).value | |
End If | |
EXTRACT_CODE = result | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment