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
| Sub Liste()
Dim NB_Lignes As Integer
Dim I As Integer ' Comptage lignes
Dim X As Integer ' Ecriture résultat
Dim Compteur As Integer ' Compteur valeurs
X = 2
Compteur = 0
NB_Lignes = ActiveSheet().UsedRange.Rows.Count
For I = 2 To NB_Lignes
If Cells(I, 1) = 0 Then
Compteur = 0
Else
If Cells(I, 1) <> Cells(I - 1, 1) Then
Compteur = 1
Else
Compteur = Compteur + 1
End If
End If
If Cells(I, 1) <> Cells(I + 1, 1) Then
Cells(X, 2) = Compteur
X = X + 1
End If
Next
End Sub |
Partager