This should work assuming you have column headers in A1 and B1 and your binary list is in column A:
Sub NumberedList()
Dim i As Integer
Dim k As Integer
Dim cl As Range
Dim preVal As Integer
ActiveSheet.UsedRange
i = 0
k = 0
With ActiveWorkbook.Worksheets
With [a1]
For Each cl In Range(.Offset(1, 0), .End(xlDown))
If cl.Value <> "" Then
i = i + 1
End If
Next cl
Do Until k = i
k = k + 1
If Range(.Offset(k, 0), .Offset(k, 0)).Value = 1 Then
Range(.Offset(k, 1), .Offset(k, 1)).Value = 1
Else
preVal = Range(.Offset(k - 1, 1), .Offset(k - 1, 1)).Value
Range(.Offset(k, 1), .Offset(k, 1)).Value = preVal + 1
End If
Loop
End With
End With
End Sub
Bookmarks