Yes there was a "bug" .. try next code
Option Explicit
Sub CotlorTr()
Dim i As Integer, J As Integer, K As Integer
Dim ColorLst
Dim ObjDic As Object
Set ObjDic = CreateObject("Scripting.Dictionary")
ObjDic.CompareMode = 1
ColorLst = Array(192, 255, 49407, 65535, 5296274, 5287936, 15773696, 12611584, 6299648, 10498160)
With ObjDic
For i = 2 To Cells(Rows.Count, 1).End(3).Row
.RemoveAll
.Item(Cells(i, 1).Value) = 1
K = 0
For J = 2 To Cells(i, Columns.Count).End(xlToLeft).Column
If (.exists(Cells(i, J).Value)) Then
If (.Item(Cells(i, J).Value) < 192) Then
K = K + 1
Cells(i, J).Interior.Color = ColorLst(K)
Cells(i, .Item(Cells(i, J).Value)).Interior.Color = ColorLst(K)
.Item(Cells(i, J).Value) = ColorLst(K) ' NEW STATEMENT
Else
Cells(i, J).Interior.Color = .Item(Cells(i, J).Value)
End If
Else
.Item(Cells(i, J).Value) = J
End If
Next J
Next i
End With
End Sub
Bookmarks