1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Sub test()
Randomize
For a = 1 To Cells(Rows.Count, 1).End(xlUp).Row
couleur = (Rnd * 56)
chaine1 = texteformaté(Cells(a, 1).Text)
For i = 1 To Cells(Rows.Count, 2).End(xlUp).Row
If chaine1 <> "" Then
chaine2 = texteformaté(Cells(i, 2).Text)
If chaine2 Like chaine1 Then texte = texte & "A" & a & " est egale a " & "b" & i & vbCrLf ': Exit For
If chaine2 Like chaine1 > 0 Then
Cells(a, 1).Font.ColorIndex = couleur
Cells(i, 2).Font.ColorIndex = couleur
Cells(i, 2).Font.Bold = True
End If
If InStr(chaine2, chaine1) > 0 Then
Cells(a, 1).Font.ColorIndex = couleur
Cells(i, 2).Font.ColorIndex = couleur
Cells(i, 2).Font.Bold = True
End If
End If
Next
Next
MsgBox texte
End Sub
Function texteformaté(mot As String) As String
texteformaté = LCase(Replace(Replace(Replace(Replace(Replace(mot, "_", "*"), "-", "*"), "?", "*"), ",", "*"), ".", "*"))
'Debug.Print Replace(Replace(Replace(Replace(Replace(mot, "_", "*"), "-", "*"), "?", "*"), ",", "*"), ".", "*")
End Function |
Partager