Is there a way to compare all columns in a Row and flag difference

G

Guest

I would like to compare that the values for each column of two different rows
are identical. If there are differences on the second row flag them somehow.

Is this possible?
 
G

Guest

To compare the value in cells in rows 2 and 5

Dim rng as Range, cell as Range
Range("2:2,5:5").Interior.ColorIndex = xlNone
set rng = Range(Cells(2,1),Cells(2,columns.Count).End(xltoLeft))
for each cell in rng
if cell <> cell.offset(3,0) then
cell.Interior.ColorIndex = 3
cell.offset(3,0).Interior.Colorindex = 3
end if
Next

Assumes column 2 has values farthest to the right or they are equal.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top