J'ai utilisé une petite fonction :
Private Function NbChampsDiff() As Integer
'Recuperation du nombre de ligne dans Nb_lignes
Nb_Lignes = Range("B65536" ).End(xlUp).Row
'Tri selon la colonne
Columns("D:D" ).Select
Selection.Sort Key1:=Range("A:A" ), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
'Compteur
Compar = 0
Count = 0
New_Compar = 0
For i = 1 To Nb_Lignes
New_Compar = Cells(i, 4)
If New_Compar <> Compar Then Count = Count + 1
Compar = New_Compar
Next
NbChampsDiff = Count
End Function
Je tri la ligne a traiter, puis je compte les champs differents
Message édité par vinc35 le 11-04-2006 à 14:02:23