How to compare values in different columns and indicate outcome
Hi Rich
Assuming two columns of data (A and B),already sorted with no breaks.
Try this
Dim task As Range
Range("a1").Select
Range(Selection, Selection.End(xlDown)).Select
Set task = Selection
For Each cell In task
cell.Interior.ColorIndex = 0
cell.Offset(0, 1).Interior.ColorIndex = 0
If cell.Value = cell.Offset(0, 1).Value Then
cell.Offset(0, 2).Value = "Same"
Else: cell.Offset(0, 2).Value = "Different"
End If
If cell.Value = cell.Offset(0, 1).Value Then
cell.Interior.ColorIndex = 4
If cell.Value = cell.Offset(0, 1).Value Then cell.Offset(0,
1).Interior.ColorIndex = 4
Next
Range("a1").Select
"rich" wrote in message
...
Hello,
I am trying to develop a spreadsheet to track implementation of
patches/service packs on different machines. I have 2 columns (A & B)
representing different machines. Each column contains a KB or Q article
number (ex: KB823803; Q147222). Each column is sorted. I need to be
able
to compare the entries on each row. If they are the same, indicate by
either:
1. Change the backgroun color of the two cells to green if they are the
same.
2. Add "same" in the C column, same row as the row being compared.
3. Any other simply and obvious indication that the 2 values being
compared
are the same.
If they are different, basically do the same thing, just indicate they are
different.
Can anyone suggest how I can quickly accomplish this? I am somewhat
familiar with VBscripting if that helps.
TIA,
Rich
|