Hello à tous,
J'ai fait le Feignant jusqu'au bout
Essaye comme ceci :
Sub Rencontre()
'L'idée de ce code est de créer une clef unique dans la colonne AA par rencontre
'je concatene le premier numéro avec le deuxieme
'Puis la même façon mais à l'envers, le deuxieme avec le premier
'Une fois que s'est fait, je compte les clefs et si elles y sont + d'une fois chacune, je coloris
Dim bytTirage As Byte
Dim bytColTirage As Byte
Dim bytDerLigTirage As Byte
Dim bytNumTirage As Byte
Dim intSynthese As Integer
Dim strClef As String
Dim strClefreverse As String
Dim intCptEqui As Integer
Range("AA:AA").Clear
bytColTirage = 2
intSynthese = 3
intCptEqui = 1000
For bytTirage = 1 To 4
bytDerLigTirage = Cells(Rows.Count, bytColTirage).End(xlUp).Row
For bytNumTirage = 3 To bytDerLigTirage Step 2
strClef = Cells(bytNumTirage, bytColTirage)
strClefreverse = Cells(bytNumTirage + 1, bytColTirage)
If (strClef & strClefreverse) = (strClefreverse & strClef) Then
strClef = strClef + intCptEqui
intCptEqui = intCptEqui + 1
strClefreverse = strClefreverse + intCptEqui
intCptEqui = intCptEqui + 1
End If
Cells(intSynthese, "AA") = strClef & strClefreverse
intSynthese = intSynthese + 1
Cells(intSynthese, "AA") = strClefreverse & strClef
intSynthese = intSynthese + 1
Next bytNumTirage
bytColTirage = bytColTirage + 5
Next bytTirage
bytColTirage = 2
intSynthese = 3
For bytTirage = 1 To 4
bytDerLigTirage = Cells(Rows.Count, bytColTirage).End(xlUp).Row
For bytNumTirage = 3 To bytDerLigTirage Step 2
strClef = Cells(bytNumTirage, bytColTirage) & Cells(bytNumTirage + 1, bytColTirage)
strClefreverse = Cells(bytNumTirage + 1, bytColTirage) & Cells(bytNumTirage, bytColTirage)
If Application.WorksheetFunction.CountIf(Range("AA:AA"), strClef) > 1 And _
Application.WorksheetFunction.CountIf(Range("AA:AA"), strClefreverse) > 1 Then
Union(Cells(bytNumTirage, bytColTirage), Cells(bytNumTirage + 1, bytColTirage)).Interior.ColorIndex = 20
End If
Next bytNumTirage
bytColTirage = bytColTirage + 5
Next bytTirage
Range("AA:AA").Clear
End Sub