私はこのコードを持っています:
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
これをループする最良の方法は何ですか? まったく同じコードのブロックが 10 個もないようにするには?
別のシートのリストから名前付き範囲を読み取るように変更できますか?
ありがとう