tri sans doublons

manuBX

XLDnaute Occasionnel
Bonsoir

je coince sur une macro ou il faut trier en B3 C18 sans doublons
les autres colonnes étant utilisés

Merci d'avance
 

Pièces jointes

  • MMV1.xls
    21.5 KB · Affichages: 24

arthur203

XLDnaute Junior
Re : tri sans doublons

Salut,

Voici un code fait à la va-vite mais qui fonctionne:

Sub Mac()

Dim i As Integer

i = Sheets("Feuil1").Range("B65536").End(xlUp).Row ' à adapter au nom de ta feuille

Range("B3:C" & i).Select ' à adapter au colonne et premier ligne

ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("B3"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

With ActiveWorkbook.Worksheets("Feuil1").Sort 'à adapter au nom de ta feuille
.SetRange Range("B3:C" & i) 'à ta plage

.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

For i = 4 To Sheets("Feuil1").Range("B65536").End(xlUp).Row
If Cells(i, 2) = Cells(i + 1, 2) And Cells(i, 3) = Cells(i + 1, 3) Then
Rows(i & ":" & i).Select
Selection.Delete Shift:=xlUp
End If
Next i
End Sub

Cheers,
 

Discussions similaires

Statistiques des forums

Discussions
312 329
Messages
2 087 332
Membres
103 519
dernier inscrit
Thomas_grc11