Hello,
I need to open archive file and compare column F of active sheet and archive sheet for occurrence and mark in acive sheet in column A if something was found.
I have code to compare fields and mark differences but now I would like to mark dubles in ActiveSheet. Mayby someone could refactor it?
Best Regards!
W.
I need to open archive file and compare column F of active sheet and archive sheet for occurrence and mark in acive sheet in column A if something was found.
I have code to compare fields and mark differences but now I would like to mark dubles in ActiveSheet. Mayby someone could refactor it?
Code:
Dim WB1 As Workbook
Dim WB2 As Workbook
Set WB1 = ActiveWorkbook
Set WB2 = Workbooks.Open("C:\Archive.xlsx")
' the code above is just for poiters - does not apply to code below
Dim Zl As Range
Dim RngZ As Range
With CreateObject("scripting.dictionary")
For Each Zl In Sheets(2).Range("E2", Sheets(2).Range("E" & Rows.count).End(xlUp))
If Not .Exists(Zl.Value) Then .Add Zl.Value, Nothing
Next Zl
For Each Zl In Sheets(1).Range("F2", Sheets(1).Range("F" & Rows.count).End(xlUp))
If Not .Exists(Zl.Value) Then
If RngZ Is Nothing Then
Set RngZ = Zl
Else
Set RngZ = Union(RngZ, Zl)
End If
End If
Next Zl
End With
If Not RngZ Is Nothing Then RngZ.EntireRow.Copy Sheets("PolisyPozaEru").Cells(Rows.count, "A").End(xlUp).Offset(1, 0)
Best Regards!
W.
Last edited: