Sub Test_RegEx()
PapyBrossard Range("A1:A4")
End Sub
Private Sub PapyBrossard(Rng As Range, Optional QUATRE_QUART As String = "4")
Dim C As Range, RE As Object, MC As Object, M As Object, I&
Set R = Rng
Set RE = CreateObject("vbscript.regexp")
With RE
.Global = True
.Pattern = "\b\d{" & QUATRE_QUART & "}\b"
For Each C In R
If .test(C.Text) = True Then
I = 0: Set MC = .Execute(C.Text)
For Each M In MC
I = I + 1: C.Offset(0, I) = M
Next M
End If
Next C
End With
End Sub