Pb de boucle moulinette trop longue

cs_papaours Messages postés 20 Date d'inscription lundi 6 janvier 2003 Statut Membre Dernière intervention 10 septembre 2003 - 31 juil. 2003 à 16:56
JoePatent Messages postés 171 Date d'inscription jeudi 30 janvier 2003 Statut Membre Dernière intervention 20 juillet 2008 - 31 juil. 2003 à 17:51
bonjour je fais tourner ce code qui supprime des lignes en doubles sur une feuille excel.
en gros j'ai 1000 lignes par feuilles et le programme mouline trop longtemps a mon gout.
il y t il un pb de memoire ou quoi si qq a une idée...
merci

Sub Supprime_Double(f)

Application.ScreenUpdating = False

'ActiveSheet.Select
Sheets(f).Select
Range("A1").CurrentRegion.Select
nbligne = Selection.Rows.Count

For i = 1 To nbligne

tmp1 = Cells(i, 1).Value
tmp2 = Cells(i, 2).Value
tmp3 = Cells(i, 3).Value
tmp4 = Cells(i, 4).Value
tmp5 = Cells(i, 9).Value
tmp6 = Cells(i, 10).Value
tmp7 = Cells(i, 12).Value

For j = i + 1 To nbligne
tmp11 = Cells(j, 1).Value
tmp12 = Cells(j, 2).Value
tmp13 = Cells(j, 3).Value
tmp14 = Cells(j, 4).Value
tmp15 = Cells(j, 9).Value
tmp16 = Cells(j, 10).Value
tmp17 = Cells(j, 12).Value

If tmp7 = tmp17 Then
If tmp6 = tmp16 Then
If tmp5 = tmp15 Then
If tmp4 = tmp14 Then
If tmp3 = tmp13 Then
If tmp2 = tmp12 Then
If tmp1 = tmp11 Then
Rows(j).Delete
nbligne = nbligne - 1
End If
End If
End If
End If
End If
End If
End If
Next j

Next i

End Sub

1 réponse

JoePatent Messages postés 171 Date d'inscription jeudi 30 janvier 2003 Statut Membre Dernière intervention 20 juillet 2008
31 juil. 2003 à 17:51
0
Rejoignez-nous