Sub DanhSachChuaNhanQua()
Dim lr&, i&, j&, k&, Sarr As Variant, Rarr As Variant
Dim Dic As Object, ID$
Set Dic = CreateObject("Scripting.Dictionary")
With Sheets("DS 1")
lr = .Range("B" & Rows.Count).End(xlUp).Row
Sarr = .Range("A3:K" & lr).Value
ReDim Rarr(1 To lr, 1 To 10)
End With
For i = 1 To UBound(Sarr, 1)
If Sarr(i, 1) <> "" Then ID = Sarr(i, 1) & Sarr(i, 8) ' ghi so ID
Sarr(i, 11) = ID
If Sarr(i, 10) <> "" Then Dic.Item(ID) = "Da nhan qua" ' Da nhan qua
Next i
' trich loc
For i = 1 To UBound(Sarr, 1)
If Dic.Exists(Sarr(i, 11)) = False Then
k = k + 1
For j = 1 To 10
Rarr(k, j) = Sarr(i, j)
Next j
End If
Next i
With Sheets("DS cac ho chua nhan qua")
' xoa du lieu
.UsedRange.Offset(2).ClearContents
' ghi ket qua
If k > 0 Then .Range("A3").Resize(k, 10) = Rarr
End With
End Sub