Dim Match, Matches
Function ExtractionCP(Cellule As Range) As String
Application.Volatile
With CreateObject("vbscript.regexp")
.Global = True
.Pattern = " \d{5} "
Set Matches = .Execute(Cellule.Text)
If Matches.Count >= 1 Then ExtractionCP = Trim(Matches(0))
End With
End Function
Function ExtractionRue(Cellule As Range) As String
Application.Volatile
With CreateObject("vbscript.regexp")
.Global = True
.Pattern = "^.* \d{5} "
Set Matches = .Execute(Cellule.Text)
If Matches.Count >= 1 Then ExtractionRue = Left(Matches(0), Len(Matches(0)) - 7)
End With
End Function
Function ExtractionVille(Cellule As Range) As String
Application.Volatile
With CreateObject("vbscript.regexp")
.Global = True
.Pattern = " \d{5} .*$"
Set Matches = .Execute(Cellule.Text)
If Matches.Count >= 1 Then ExtractionVille = Right(Matches(0), Len(Matches(0)) - 7)
End With
End Function