Quickly made a small code for a macro to put in a module for example (values in column A and column B result)

Code:

Sub List()
Dim NB_Lines As Integer
Dim I As Integer 'Counting Lines
Dim X As Integer 'Write result
Dim Counter As Integer ' Counter values
X = 2
Counter = 0
NB_Lines = ActiveSheet().UsedRange.Rows.Count
For I = 2 To NB_Lines
If Cells(I, 1) = 0 Then
Counter = 0
Else
If Cells(I, 1) <> Cells(I - 1, 1) Then
Counter = 1
Else
Counter = Counter + 1
End If
End If
If Cells(I, 1) <> Cells(I + 1, 1) Then
Cells(X, 2) = Counter
X = X + 1
End If
Next
End Sub

## Bookmarks