,如果你的号码分成的总是不同的号码重复的块,那么你可以使用这个VBA代码:
Sub main()
Dim item As Variant
Dim startRow As Long
Dim okHighlight As Boolean
With Range("A1", Cells(Rows.count, 1).End(xlUp))
For Each item In GetUniqueValues(.Cells).Items
If okHighlight Then .Range(.Cells(startRow, 1), .Cells(item, 1)).Interior.ColorIndex = 48
startRow = item + 1
okHighlight = Not okHighlight
Next
End With
End Sub
Function GetUniqueValues(rng As Range) As Dictionary
Dim cell As Range
Dim dict As Dictionary
Set dict = New Dictionary
With dict
For Each cell In rng
.item(cell.Value) = cell.row - rng.Rows(1).row + 1
Next
End With
Set GetUniqueValues = dict
End Function
一个条件格式的做法有可能在与帮手 column
假设:
然后:
写如下式辅助柱B细胞:
=IF(A2<>A1,B1+1,0)
应用条件格式列A用下面的公式:
=INT(B2/2)=B2/2
,并选择您喜欢的格式来突出显示单元格
这是Excel的?没有看到任何方式条件格式可以实现这一点。所以你将不得不研究VBA方法。 – June7