Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Integer, num As Byte
num = 0
For i = 2 To Range('B65536').End(xlUp).Row
If IsEmpty(Target) Then Exit Sub
If Not Cells(i, 2).Value = '' Then
Cells(i, 1).Value = num + 1
num = num + 1
Else
Cells(i, 1).Value = ''
End If
Next i
End Sub