conditionally format based on intersheet cell comparisons

  • Thread starter Thread starter oldyork90
  • Start date Start date
O

oldyork90

I have two sheets, A and B. Both sheets once had the same data. On
sheet A, some cells in col CC have been updated. I want to change the
background of Sht A, col CC cells if the value doesn't match
corresponding cell value in ShtB.

I can do this cell by cell... but can't figure out to select all the
cells at once.

Thank you.
 
Sub NoMatch()
Dim iEnd As Integer
Dim c As Range
Dim rng As Range
iEnd = Sheets("A").Range("CC1").End(xlDown).Row
Set rng = Sheets("A").Range("CC1:CC" & iEnd)
For Each c In rng
If c <> Sheets("B").Range(c.Address) Then c.Interior.ColorIndex = 6
Next c
End Sub
 
Back
Top