Macro de tri avec decompte des doublons

D

Dominique

Guest
Pourriez vous m'aidez je rexplique dans l'exemple.
 

Pièces jointes

  • TRICROISSANT.xls
    48.5 KB · Affichages: 59
  • TRICROISSANT.xls
    48.5 KB · Affichages: 56
  • TRICROISSANT.xls
    48.5 KB · Affichages: 59
V

vincent

Guest
Bonsoir,

Voilà une solutions par macro

Option Explicit
Sub TRI()
'
' tri Macro
Dim compteur As Integer
Dim i As Long
Dim rang As Long
Range("A1:B11").Select
Selection.Sort Key1:=Range("b1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("D4").Select
For i = 2 To Range("b65536").End(xlUp).Row
rang = i
compteur = 0
Do
rang = rang + 1
compteur = compteur + 1
Cells(rang - 1, 1) = compteur
Loop Until Cells(rang, 2) <> Cells(rang - 1, 2)
i = rang - 1
Next
End Sub

bonne soirée

@+Vincent
 

Statistiques des forums

Discussions
314 085
Messages
2 105 645
Membres
109 407
dernier inscrit
gueric6