我在列中有一组值,1 NA 0 1 0 NA和0.我在列上运行一个成功的脚本以突出显示深绿色的顶部值和前50%的值(不包括顶部)浅绿色。
Image.split(img)
这有效,但我现在要做的事情(这将被添加到所有列,其中大多数具有更高的数字)是从值为0的任何单元格中删除突出显示。我尝试了下面的代码:< / p>
Range("K4:K10").Select
Selection.FormatConditions.AddTop10
With Selection.FormatConditions(1)
.TopBottom = xlTop10Top
.Rank = 50
.Percent = True
End With
With Selection.FormatConditions(1).Interior
.Color = 13434777
End With
Selection.FormatConditions.AddTop10
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1)
.TopBottom = xlTop10Top
.Rank = 1
End With
With Selection.FormatConditions(1).Interior
.Color = 3394611
End With
但它正在删除列中每个单元格的突出显示,而不管其值如何。有什么想法吗?
答案 0 :(得分:1)
将选择更改为wsrng。
Dim wsrng As Range
For Each wsrng In Range("K4:K10")
If wsrng.Value = 0 Then
wsrng.FormatConditions.Delete
End If
Next wsrng