Hi,
I would like to look for contents of cells in column A Sheet 1 and compare it to contents in Sheet 2.
If it can be found (ex. A6 sheet 1 was found in A99 sheet 2) than I want to compare column C in both sheets. If its not match - remove row in sheet 2.
my code to compare and remove unique values from Sheet 2
Id like it to "IF" value is found check column C if it is a match too.
Best regards
w.
I would like to look for contents of cells in column A Sheet 1 and compare it to contents in Sheet 2.
If it can be found (ex. A6 sheet 1 was found in A99 sheet 2) than I want to compare column C in both sheets. If its not match - remove row in sheet 2.
my code to compare and remove unique values from Sheet 2
Code:
Dim Cl As Range
Dim Rng As Range
With CreateObject("scripting.dictionary")
For Each Cl In Sheets(1).Range("A2", Sheets(1).Range("A" & Rows.Count).End(xlUp))
If Not .Exists(Cl.Value) Then .Add Cl.Value, Nothing
Next Cl
For Each Cl In Sheets(2).Range("A2", Sheets(2).Range("A" & Rows.Count).End(xlUp))
If Not .Exists(Cl.Value) Then
If Rng Is Nothing Then
Set Rng = Cl
Else
Set Rng = Union(Rng, Cl)
End If
End If
Next Cl
End With
If Not Rng Is Nothing Then Rng.EntireRow.Delete
Id like it to "IF" value is found check column C if it is a match too.
Best regards
w.
Last edited: