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 34 35 36 37 38 39
|
Sub essai_27()
Application.ScreenUpdating = False
Dim nom(500) As Variant, adresse1(500) As Variant, adresse2(500) As Variant
Dim fin As Long
caractere = Array("é", "à", "è", "ç")
caracterebis = Array("e", "a", "e", "c")
fin = Range("d" & Rows.Count).End(xlUp).Row
For i = 2 To fin
If Right(Cells(i, "d"), 1) = " " Then Cells(i, "d") = Left(Cells(i, "d"), Len(Cells(i, "d")) - 1)
If Right(Cells(i, "d"), 1) = " " Then Cells(i, "d") = Left(Cells(i, "d"), Len(Cells(i, "d")) - 2)
If Right(Cells(i, "d"), 1) = "." Then Cells(i, "d") = Left(Cells(i, "d"), Len(Cells(i, "d")) - 1)
If Right(Cells(i, "d"), 1) = ". " Then Cells(i, "d") = Left(Cells(i, "d"), Len(Cells(i, "d")) - 2)
If Right(Cells(i, "e"), 1) = " " Then Cells(i, "e") = Left(Cells(i, "e"), Len(Cells(i, "e")) - 1)
If Right(Cells(i, "f"), 1) = " " Then Cells(i, "f") = Left(Cells(i, "f"), Len(Cells(i, "f")) - 1)
For car = 0 To 3
'on remplace les caractere avec accents et on met em majuscule les variables adresse pour pouvoir les comparer
Cells(i, "e") = Replace(Cells(i, "e"), caractere(car), caracterebis(car)) 'a chaque tour de boucle la variable adresse prend la valeur de la celulle"e" en ligne "i"
Cells(i, "f") = Replace(Cells(i, "f"), caractere(car), caracterebis(car)) 'a chaque tour de boucle la variable adresse prend la valeur de la celulle"f" en ligne "i"
Next
nom(i) = UCase(Cells(i, "d"))
adresse1(i) = UCase(Cells(i, "e"))
adresse2(i) = UCase(Cells(i, "f"))
Next
For a = 2 To fin
For Z = 3 To fin
DoEvents
If nom(Z) = nom(a) And adresse1(Z) = adresse1(a) And adresse2(Z) = adresse2(a) Then
If Z <> a Then Rows(Z & ":" & Z).Delete
End If
Next Z
Next a
nom(500) = ""
adresse1(500) = ""
adresse2(500) = ""
End Sub |
Partager