Find duplicate values within the same row (Excel)
<p>I have a list of addresses and parts of the addresses for some records have been duplicated. e.g. some records contain "London" in both column D and column E.</p>

<p>I want to find and highlight any duplicate values across all columns, but within the same row.</p>

<p>So far I have written the code below, but I want it to work through every column containing values and not just the two columns I have named.</p>

<pre><code>Dim Lastrow As Long
Dim i As Long
Lastrow = Range("D" &amp; Rows.Count).End(xlUp).Row
For i = 2 To Lastrow
    If Range("D" &amp; i).Value = Range("E" &amp; i).Value Then
        Range("E" &amp; i).Interior.ColorIndex = 6
    End If
Next i
</code></pre>

<p>I have tried to search for an answer, but I have only been able to find ways of highlighting entire duplicate rows or duplicate values in different columns and rows.</p>

<p>Thank you for taking the time to read this and for any help you can give.</p>