0
即時通訊新的vba和我需要幫助重複顏色重複行而不是隻有這個做的單元格,任何人都可以幫助我在這裏。VBA:如何爲重複行着色?
Sub FindDuplicate()
Dim cel As Variant
Dim myrng As Range
Dim clr As Long
Set myrng = Range("S2:S" & Range("S65536").End(xlUp).row)
myrng.Interior.ColorIndex = xlNone
clr = 3
For Each cel In myrng
If Application.WorksheetFunction.CountIf(myrng, cel) > 1 Then
If WorksheetFunction.CountIf(Range("S2:S" & cel.row), cel) = 1 Then
cel.Interior.ColorIndex = 3
Else
cel.Interior.ColorIndex = myrng.Cells(WorksheetFunction.Match(cel.Value, myrng, False), 1).Interior.ColorIndex
End If
End If
Next
End Sub