Sub test()
Dim newval$, i&, Firstindex&, texte$, regex As Object, Matchs As Object
newval = ""
tableau = Range("A6:AE" & Cells(Rows.Count, "A").End(xlUp).Row)
For i = 1 To UBound(tableau)
If tableau(i, 7) <> newval Then
If Firstindex > 0 Then
t = Split(tableau(Firstindex, 31), "-")
For x = 0 To UBound(t)
If Not Trim(t(x)) = "" And Not texte Like "*" & Trim(t(x)) & "*" Then texte = texte & "-" & t(x)
Next
If Left(texte, 1) = "-" Then texte = Mid(texte, 2)
tableau(Firstindex, 31) = texte
'**********************************************************************************************************
texte = tableau(Firstindex, 31)
With CreateObject("VBScript.RegExp")
.Global = True: .IgnoreCase = True: .Pattern = "[^\w]+(\d{2})+[^\w]+(\d{2})+[^\w]+(\d{2})+(\D{20,200})"
Set Matchs = .Execute(texte)
Debug.Print tableau(Firstindex, 7); " :occurences chaines " & Matchs.Count
If Matchs.Count > 0 Then
For x = 0 To Matchs.Count - 1
Debug.Print tableau(Firstindex, 7) & "--->" & Matchs(x)
Next
End If
End With
'**********************************************************************************************************
End If
Firstindex = i
newval = tableau(i, 7)
texte = ""
Else
If tableau(i, 31) <> "" Then
tableau(Firstindex, 31) = tableau(Firstindex, 31) & " - " & tableau(i, 31): tableau(i, 31) = ""
End If
'on enleve les doublons(texte dans le resultat en first cellule de chaque valeur
'en gros on suprime les chaines qui se repete mot pour mots
End If
Next i
Application.EnableEvents = False
'Cells(6, "AE").Resize(UBound(tableau), 1) = WorksheetFunction.Index(tableau, 0, 31) 'on retranscrit que la colonne 31 "AE"
Application.EnableEvents = True
End Sub