我有这个代码:
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($B5=""ARC"",1,0)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = ColorSheet.Range("ARC_Color").Interior.Color
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($B5=""ALL"",1,0)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = ColorSheet.Range("ALL_Color").Interior.Color
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
还有比这更多的块,基本上所有的变化都是条件格式条件中引用的命名范围。
=IF($B5=""ALL"",1,0)
ColorSheet.Range("ALL_Color").Interior.Color
循环这个的最好方法是什么?所以我没有十个完全相同的代码块?
我可以更改它以从单独的工作表上的列表中读取命名范围吗?
谢谢