bjr,
Ci dessous un code qui ne fonctionne pas correctement.
J'ai deux feuilles avec 26 colonnes chacunes. Premiere colonne on a des noms qui commencent par la lettre A sur les deux feuilles, pour la deuxième colonne donc la "B" on a des noms qui commencent par la lettre B. Et cela pour les 26 lettres de l'alphabet. On a ça sur les deux feuilles.
voici mon code qui ne nettoye pas tout car j'ai plus de ligne sur la colonne C que sur la A et la B... . En plus je ne sais pas comment eviter de mettre ce code 26 fois, une fois pour chaque lettre.
voir ci dessous.
Si vous pouvez m'aider, mille mercisssssss
Merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
40
41
42
43 Sub Compare() Dim LastLig1 As Long, LastLig2 As Long, i As Long Dim c As Range LastLig1 = Sheets("Feuil4").Cells(Rows.Count, 1).End(xlUp).Row With Sheets("Feuil3") LastLig2 = .Cells(Rows.Count, 1).End(xlUp).Row For i = LastLig2 To 1 Step -1 Set c = Sheets("Feuil4").Range("A1:A" & LastLig1).Find(.Range("A" & i).Value, lookat:=xlWhole) If Not c Is Nothing Then .Rows(i).Delete Set c = Nothing End If Next i End With LastLig1 = Sheets("Feuil4").Cells(Rows.Count, 1).End(xlUp).Row With Sheets("Feuil3") LastLig2 = .Cells(Rows.Count, 1).End(xlUp).Row For i = LastLig2 To 1 Step -1 Set c = Sheets("Feuil4").Range("B1:B" & LastLig1).Find(.Range("B" & i).Value, lookat:=xlWhole) If Not c Is Nothing Then .Rows(i).Delete Set c = Nothing End If Next i End With LastLig1 = Sheets("Feuil4").Cells(Rows.Count, 1).End(xlUp).Row With Sheets("Feuil3") LastLig2 = .Cells(Rows.Count, 1).End(xlUp).Row For i = LastLig2 To 1 Step -1 Set c = Sheets("Feuil4").Range("C1:C" & LastLig1).Find(.Range("C" & i).Value, lookat:=xlWhole) If Not c Is Nothing Then .Rows(i).Delete Set c = Nothing End If Next i End With ...... End Sub![]()
Partager