• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Have to compare two columns and highlight both the columns.

Rafay Ahmed

New Member
Hi All,
I tried to construct a macro to compare the two columns and highlight them. Any other good alternative would be appreciated.
Guidelines are also there in the attached sheet.


Marc L

Excel Ninja
Hi !

At least share the code you tried to construct !

And if it's just to compare numbers on same row,
you do not ever need a code but just apply a conditional formatting …

Marc L

Excel Ninja
So without any CF :​
Sub Demo1()
         Dim Rd As Range, Rc As Range, R&
     [A1].CurrentRegion.Columns("F:G").Interior.ColorIndex = xlNone
With Range([G1].End(xlDown), Cells(Rows.Count, 7).End(xlUp))
    For Each Rd In Range("F2", [F1].End(xlDown))
           Set Rc = .Find(Rd.Value, , xlValues, xlWhole)
        If Not Rc Is Nothing Then
                R = Rc.Row
               If Rc.Interior.ColorIndex = xlNone Then
                   Union(Rc, Rd).Interior.ColorIndex = 40
                   Exit Do
                   Set Rc = .FindNext(Rc)
               End If
            Loop Until Rc.Row = R
        End If
End With
           Set Rc = Nothing
End Sub
Do you like it ? So thanks to click on bottom right Like !