Hi
try this. adjust the sheet names in the code.
Code:Option Explicit Sub kTest() Dim ka, k(), i As Long, n As Long, c As Long, d As Object Const MasterSheet As String = "Sheet1" '<< adjust Const NewData As String = "Sheet2" '<< adjust Set d = CreateObject("scripting.dictionary") d.comparemode = 1 ka = ThisWorkbook.Worksheets(MasterSheet).Range("a1").CurrentRegion.Resize(, 10).Value2 For i = 2 To UBound(ka, 1) If Len(Trim(ka(i, 4))) Then d.Item(Trim(ka(i, 4))) = Empty End If Next Erase ka ka = ThisWorkbook.Worksheets(NewData).Range("a1").CurrentRegion.Resize(, 10).Value2 ReDim k(1 To UBound(ka, 1), 1 To UBound(ka, 2)) For i = 2 To UBound(ka, 1) If Not d.exists(ka(i, 4)) Then n = n + 1 For c = 1 To UBound(ka, 2) k(n, c) = ka(i, c) Next End If Next If n Then 'append new record into the master sheet With ThisWorkbook.Worksheets(MasterSheet) .Range("a" & .Rows.Count).End(xlUp).Offset(1).Resize(n, UBound(k, 2)) = k End With End If End Sub




Reply With Quote
Bookmarks