Sub CopyCells()
Application.ScreenUpdating = False
Dim i As Long, v As Variant, fVisRow As Long, rng As Range, Val As String
v = Range("B2", Range("B" & Rows.Count).End(xlUp)).Value
With CreateObject("Scripting.Dictionary")
For i = 1 To UBound(v, 1)
If Not .Exists(v(i, 1)) Then
.Add v(i, 1), Nothing
With Range("A1").CurrentRegion
.AutoFilter 2, v(i, 1)
fVisRow = .Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible).Cells(1, 1).Row
For Each rng In Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
If Val = "" Then Val = rng Else Val = Val & ", " & rng
Next rng
Range("C" & fVisRow) = Val
Val = ""
End With
End If
Next i
End With
Range("A1").AutoFilter
Application.ScreenUpdating = True
End Sub