用条件格式较难,用vba编程较简单,已成功调试,供参考
Sub rr()
n = Val(InputBox("请车入连续重复的次数", "输入提示"))
'Set myrng = Application.InputBox("请在工作表中选定单元格区域", Type:=8)
Set myrng = [B2].CurrentRegion
myrng.Font.ColorIndex = xlAutomatic
For Each c In myrng
Set Rng = c.Resize(n, 1)
p = WorksheetFunction.CountIf(Rng, c.Value)
If p >= n Then
Rng.Font.Color = -16776961
End If
Next
End Sub
用条件格式较难,用vba编程较简单,已成功调试,供参考
Sub rr()
n = Val(InputBox("请车入连续重复的次数", "输入提示"))
'Set myrng = Application.InputBox("请在工作表中选定单元格区域", Type:=8)
Set myrng = [B2].CurrentRegion
myrng.Font.ColorIndex = xlAutomatic
For Each c In myrng
Set Rng = c.Resize(n, 1)
p = WorksheetFunction.CountIf(Rng, c.Value)
If p >= n Then
Rng.Font.Color = -16776961
End If
Next
End Sub