Related:
- Color Rows after Comparing
- Excel color row if cell contains text ✓ - Forum - Excel
- Excel - Compare two lists and change row color - How-To - Excel
- Excel - A macro to change the color of row on condition - How-To - Excel
- How to change row color in Excel VBA based on value - Guide
- If a cell has a certain value after certain date, color the row ✓ - Forum - Excel
2 replies
venkat1926
Jul 9, 2009 at 08:16 PM
- Posts
- 1864
- Registration date
- Sunday June 14, 2009
- Status
- Contributor
- Last seen
- August 7, 2021
Jul 9, 2009 at 08:16 PM
one way is while copying, the entry which is in sheet 1 and not in sheet 2, then itself color the entry.
as You have already copied many entries now this cannot be done
so the logic should be
any entry in sheet 3 is available in sheet 1 and not sheet 2 it should be colored.
the macro will be SOMETHING LIKE THIS. NEEDS DEBUGGING AND MODIFICATION IF NECESSARY
I have only shown the model. check and post feedback
as You have already copied many entries now this cannot be done
so the logic should be
any entry in sheet 3 is available in sheet 1 and not sheet 2 it should be colored.
the macro will be SOMETHING LIKE THIS. NEEDS DEBUGGING AND MODIFICATION IF NECESSARY
I have only shown the model. check and post feedback
Sub test() Dim rng As Range, c As Range, cfind1 As Range, cfind2 As Range On Error Resume Next With Worksheets("sheet3") Set rng = .usesdrange For Each c In rng With Worksheets("sheet1") Set cfind1 = .Cells.Find(what:=c.Value, lookat:=xlWhole) If cfind1 Is Nothing Then GoTo line1 With Worksheets("sheet2") Set cfind2 = .Cells.Find(what:=c.Value, lookat:=xlWhole) If cfind2 Is Nothing Then GoTo line2 End With End With line2: c.Interior.ColorIndex = 3 line1: Next c End With End Sub
hi and thanks!
it works just in parts.
the script cannot differentiate between var4 which is in the column "B"of "tab2" and which is not.
these which are present in tab2 are supposed to be colored yellow (because they are only an update) and these which are new should be green...
Thanks a lot for the effort...
sr7
it works just in parts.
the script cannot differentiate between var4 which is in the column "B"of "tab2" and which is not.
these which are present in tab2 are supposed to be colored yellow (because they are only an update) and these which are new should be green...
cfind1 As Range, cfind2 As Range For iCol = 1 To MaxCol For iRow = 1 To MaxRow If tab3.Cells(iRow, iCol).Value = 0 Then On Error Resume Next Else var4 = tab3.Cells(iRow, iCol) With tab2.Range("B:B") Set cfind1 = Cells.Find(What:=tab3.Cells(iRow, iCol), LookIn:=xlValues) If cfind1 Then tab3.Cells(iRow, 2).Interior.ColorIndex = 4 Else tab3.Cells(iRow, 2).Interior.ColorIndex = 6 End If End With End If Next iRow Next iCol
Thanks a lot for the effort...
sr7