Exception when highlighting duplicates
<p>I'm trying to highlight values in one column based on another column data. I have C1,C2 colums where for eg: 8A83-AA in both C1 and C2 has different Val1 and Val2 in some rows, if 8A83-AA(both occurrences) that matches val1 and val2 data then val1 highlight with green otherwise orange. The result should looks like</p>

<p><a href="https://i.stack.imgur.com/alN5S.png" rel="nofollow"><img src="https://i.stack.imgur.com/alN5S.png" alt="enter image description here"></a></p>

<p>I've tried the code in stackoverflow</p>

<pre><code>Sub Highlight_Duplicate_Entry()
Dim ws As Worksheet
Dim cell As Range
Dim myrng As Range
Dim clr As Long
Dim lastCell As Range

Set ws = ThisWorkbook.Sheets("Sheet1")
Set myrng = ws.Range("A2:d" &amp; Range("A" &amp; ws.Rows.Count).End(xlUp).Row)
With myrng
    Set lastCell = .Cells(.Cells.Count)
End With
myrng.Interior.ColorIndex = xlNone
clr = 3

For Each cell In myrng
    If Application.WorksheetFunction.CountIf(myrng, cell) &gt; 1 Then
        ' addresses will match for first instance of value in range
        If myrng.Find(what:=cell, lookat:=xlWhole, MatchCase:=False, after:=lastCell).Address = cell.Address Then
            ' set the color for this value (will be used throughout the range)
            cell.Interior.ColorIndex = clr
            clr = clr + 1
        Else
            ' if not the first instance, set color to match the first instance
            cell.Interior.ColorIndex = myrng.Find(what:=cell, lookat:=xlWhole, MatchCase:=False, after:=lastCell).Interior.ColorIndex
        End If
    End If
Next
End Sub
</code></pre>

<p>but it gives me exception object or block variable not set. I tried this range for one column at a time
   <code>Set myrng = ws.Range("A2:A600")</code>, it works. 
 but for multiple column 
   <code>Set myrng = ws.Range("A2:D600")</code> it is giving exception.
And how do i highlight which looks like in above picture data with VBA or conditional formating.</p>