Sub Ghi_GopNhatky()
Dim sArr, dArr(1 To 65535, 1 To 2)
Dim I As Long, j As Long, K As Long, x As Long, er As Long
Dim Dic As Object, v As Variant
Set Dic = CreateObject("Scripting.Dictionary")
With Sheets("Nhatky")
sArr = .Range("A4", .Range("A65535").End(3)).Resize(, 2).Value
End With
For I = 1 To UBound(sArr)
If Not Dic.exists(sArr(I, 1)) Then
K = K + 1
Dic.Add sArr(I, 1), K
dArr(K, 1) = sArr(I, 1)
dArr(K, 2) = sArr(I, 2) & vbNewLine
Else
dArr(Dic.Item(sArr(I, 1)), 2) = dArr(Dic.Item(sArr(I, 1)), 2) & sArr(I, 2) & vbNewLine
End If
Next I
With Sheets("GhiNhatky")
er = .Range("B65535").End(3).Row + 1
.Range("A6:B" & er).ClearContents
.Range("A6").Resize(K, 2) = dArr
End With
Set Dic = Nothing
End Sub