Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim i, j, fini As Integer
Range("$B:$B").Value = Range("$A:$A").Value
i = 1
While Cells(i, 2).Value <> ""
i = i + 1
Wend
fini = i - 1
For i = 1 To fini
For j = i To fini
If Left(Right(Cells(j, 2).Value, Len(Cells(j, 2).Value) - InStr(1, Cells(j, 2).Value, "@", vbTextCompare)), _
Len(Right(Cells(j, 2).Value, Len(Cells(j, 2).Value) - InStr(1, Cells(j, 2).Value, "@", vbTextCompare))) - 1) * 1 _
< Left(Right(Cells(i, 2).Value, Len(Cells(i, 2).Value) - InStr(1, Cells(i, 2).Value, "@", vbTextCompare)), _
Len(Right(Cells(i, 2).Value, Len(Cells(i, 2).Value) - InStr(1, Cells(i, 2).Value, "@", vbTextCompare))) - 1) * 1 Then
Cells(1, 3).Value = Cells(j, 2).Value
Cells(j, 2).Value = Cells(i, 2).Value
Cells(i, 2).Value = Cells(1, 3).Value
End If
Next j
Next i
Cells(1, 3).Value = ""
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub