Всем добрый день. Вопрос такой. Есть макрос, который сравнивает данные первого столбца с данными второго столбца, и если данные во втором столбце повторяются, он их красит. Так вот такой вопрос, как можно исправить данный макрос, что бы он красил только второе повторение, третье и так далее.
Sub DeleteDubls()
Const intDataCol = 5
Const intMaxRow = 140
Dim i%, j%
Dim strValue1$, strValue2$
For i = 2 To intMaxRow - 1
strValue1 = Trim(Cells(i, intDataCol))
For j = i + 1 To intMaxRow
strValue2 = Trim(Cells(j, intDataCol))
If StrComp(strValue1, strValue2, vbTextCompare) = 0 Then
Cells(j, intDataCol).Interior.ColorIndex = 4
End If
Next
Next
End Sub
Файл с тем как должно выглядеть прикреплен
Sub DeleteDubls()
Const intDataCol = 5
Const intMaxRow = 140
Dim i%, j%
Dim strValue1$, strValue2$
For i = 2 To intMaxRow - 1
strValue1 = Trim(Cells(i, intDataCol))
For j = i + 1 To intMaxRow
strValue2 = Trim(Cells(j, intDataCol))
If StrComp(strValue1, strValue2, vbTextCompare) = 0 Then
Cells(j, intDataCol).Interior.ColorIndex = 4
End If
Next
Next
End Sub
Файл с тем как должно выглядеть прикреплен