Hi,
I have a code but can't adjust it for my needs. I just want to have rows highlighted when concatenated values from col A and B doesn't exist in col C and D.
I'f be grateful if you could help me
I have a code but can't adjust it for my needs. I just want to have rows highlighted when concatenated values from col A and B doesn't exist in col C and D.
I'f be grateful if you could help me
Code:
Sub Compare()
Dim Range1 As Range, Range2 As Range, Rng1 As Range, Rng2 As Range, outRng As Range
Dim xValue As String
'Set Range1 = Application.Selection
Set Range1 = Worksheets(1).Range("A1:A11")
Set Range2 = Worksheets(1).Range("C1:C11")
Application.ScreenUpdating = False
Cells.ClearFormats
For Each Rng1 In Range1
xValue = Rng1.Value & Rng1.Offset(0, 1).Value
For Each Rng2 In Range2
If xValue = Rng2.Value & Rng2.Offset(0, 1).Value Then
If outRng Is Nothing Then
Set outRng = Rng1
Else
Set outRng = Application.Union(outRng, Rng1)
End If
End If
Next
Next
outRng.Interior.ColorIndex = 3
Application.ScreenUpdating = True
End Sub