Option Explicit
Public Sub RearrangeData()
Dim arl1 As Object, arl2 As Object
Dim vRng As Variant
Dim bool As Boolean
Dim lCol As Long, i As Long, j As Long
vRng = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Value
Set arl1 = CreateObject("System.Collections.ArrayList")
Set arl2 = CreateObject("System.Collections.ArrayList")
'Build Unique list
For i = LBound(vRng) To UBound(vRng)
If Not arl1.contains(vRng(i, 1)) Then
arl1.Add vRng(i, 1)
End If
Next i
'Sort arraylist data
arl1.Sort
'Build up second list getting count of elements
For i = 0 To arl1.Count - 1
For j = LBound(vRng) To UBound(vRng)
If arl1(i) = vRng(j, 1) And bool = False Then
arl2.Add 1
bool = True
ElseIf arl1(i) = vRng(j, 1) And bool = True Then
arl2(arl2.Count - 1) = arl2(arl2.Count - 1) + 1
End If
Next j
bool = False
Next i
'Find out last used column
lCol = Cells.Find("*", [A1], xlFormulas, xlPart, xlByColumns, xlPrevious).Column + 1
'Paste data
For i = 0 To arl1.Count - 1
Cells(1, lCol + i).Resize(arl2(i), 1).Value = arl1(i)
Next i
'Release arraylists
Set arl1 = Nothing
Set arl2 = Nothing
End Sub