Option Explicit
Sub abc()
Dim a, i, n, d
a = [a1].CurrentRegion.Resize(, 1).Value
Set d = CreateObject("scripting.dictionary")
For i = 1 To UBound(a)
If Not d.exists(a(i, 1)) Then n = n + 1: d(a(i, 1)) = n
a(i, 1) = d(a(i, 1))
Next
[b1].Resize(UBound(a)) = a
End Sub