Voici la macro correspondante :
Sub Test()
Dim Ligne As Long
Range("A8", Range("A8").End(xlDown)).ClearContents
For Ligne = 8 To Range("B" & Rows.Count).End(xlUp).Row
If Range("B" & Ligne).Value <> "" Then
Range("A" & Ligne) = "NB_" & Format(Application.CountIf(Range(Range("B8"), Range("B" & Ligne)), "<>"), "00")
Else
Range("A" & Ligne) = ""
End If
Next Ligne
End Sub
A+