E muốn lọc lấy dữ liệu ko trùng nhau tu sheet nhat ky sang sheet tổng:
cột A,C,D,E của sheet 10 sang cột B,C,D,E sheet 11 tương ứng.
rất mong a/c hướng dẫn giúp.
Sub rep()
Dim i As Long, j As Long, K As Long
Dim K1 As Long
Dim ArrNguon()
Dim ArrDich()
Dim Arr_MH()
Dim Dongcuoi As Long
Dim Dic_MH As Object
Dongcuoi = Sheet10.Range("e60000").End(xlUp).Row
ArrNguon = Sheet10.Range("a6:m" & Dongcuoi)
ReDim Arr_MH(1 To UBound(ArrNguon, 1), 1 To 5)
ReDim Arr_Ngay(1 To 1, 1 To UBound(ArrNguon, 1))
Sheet11.Range("a10:d60000").ClearContents
Set Dic_MH = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(ArrNguon, 1)
If Trim(ArrNguon(i, 5)) <> "" Then 'Trim loc bo khoang trong, cot 5 Ma'
If Not Dic_MH.Exists(ArrNguon(i, 5)) Then
K = K + 1
Dic_MH.Add ArrNguon(i, 5), K
Arr_MH(K, 1) = K
Arr_MH(K, 2) = ArrNguon(i, 1)
Arr_MH(K, 3) = ArrNguon(i, 3)
Arr_MH(K, 4) = ArrNguon(i, 4)
Arr_MH(K, 5) = ArrNguon(i, 5)
End If
End If
Next
Sheet11.Range("B9").Resize(K, 3).NumberFormat = "@"
Sheet11.Range("A9").Resize(K, 4) = Arr_MH
End Sub
cột A,C,D,E của sheet 10 sang cột B,C,D,E sheet 11 tương ứng.
rất mong a/c hướng dẫn giúp.
Sub rep()
Dim i As Long, j As Long, K As Long
Dim K1 As Long
Dim ArrNguon()
Dim ArrDich()
Dim Arr_MH()
Dim Dongcuoi As Long
Dim Dic_MH As Object
Dongcuoi = Sheet10.Range("e60000").End(xlUp).Row
ArrNguon = Sheet10.Range("a6:m" & Dongcuoi)
ReDim Arr_MH(1 To UBound(ArrNguon, 1), 1 To 5)
ReDim Arr_Ngay(1 To 1, 1 To UBound(ArrNguon, 1))
Sheet11.Range("a10:d60000").ClearContents
Set Dic_MH = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(ArrNguon, 1)
If Trim(ArrNguon(i, 5)) <> "" Then 'Trim loc bo khoang trong, cot 5 Ma'
If Not Dic_MH.Exists(ArrNguon(i, 5)) Then
K = K + 1
Dic_MH.Add ArrNguon(i, 5), K
Arr_MH(K, 1) = K
Arr_MH(K, 2) = ArrNguon(i, 1)
Arr_MH(K, 3) = ArrNguon(i, 3)
Arr_MH(K, 4) = ArrNguon(i, 4)
Arr_MH(K, 5) = ArrNguon(i, 5)
End If
End If
Next
Sheet11.Range("B9").Resize(K, 3).NumberFormat = "@"
Sheet11.Range("A9").Resize(K, 4) = Arr_MH
End Sub