假如你的重复数据在A列:
那么在B1输入false或true,
然后B2=IF(A2=A1,B1,NOT(B1)),并下拉.
然后在B列筛选false,把所有筛选出来的设为一个颜色,再筛选true的设为另一个颜色.
这样所有相同的数据就会用不同的颜色区分开了.
以上是用两种颜色来间隔差区别数据.
如果3,3,8,8,8,8,9,9,9,9,5,5,5,5,6,6,.....这样要设置都互不相同的颜色,可考虑用VBA做,也挺简单,有需要的话,再追问吧.
追问用VBA怎么做呢?请赐教
追答建一个commandButton,然后把以下代码复制进去就可以.
Private Sub CommandButton1_Click()
n = 1
For i = 1 To Range("a65536").End(xlUp).Row
If n = 50 Then n = 1
If Cells(i + 1, 1) = Cells(i, 1) Then
Cells(i + 1, 1).Interior.ColorIndex = Cells(i, 1).Interior.ColorIndex
Else
Cells(i + 1, 1).Interior.ColorIndex = n
n = n + 1
End If
Next i
End Sub上面这段代码是让不同的数据区域填充色不同.
如下要让不同的数据区域字体颜色不同,就用下面这段代码.
Private Sub CommandButton1_Click()
n = 1
For i = 1 To Range("a65536").End(xlUp).Row
If n = 50 Then n = 1
If Cells(i + 1, 1) = Cells(i, 1) Then
Cells(i + 1, 1).Font.ColorIndex = Cells(i, 1).Font.ColorIndex
Else
Cells(i + 1, 1).Font.ColorIndex = n
n = n + 1
End If
Next i
End Sub
本回答被网友采纳