0
像任何人使用條件格式,但也做了大量的複製和粘貼,我真的很厭惡我的表單上的許多規則,因爲我複製粘貼了一些單元格。所以我的想法是我應該硬編碼條件格式,然後製作一個宏來清除所有的格式並重新應用它。唉VBA今天似乎恨我!VBA條件編程微妙
爲什麼不這項工作:
Sheets("Log").Cells.FormatConditions.Delete
With Range("D1:H63")
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=D1='Working')"
With .FormatConditions(.FormatConditions.Count)
.SetFirstPriority
With .Interior
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
End With
End With
End With
在這個例子中,我從其他地方得到的也是如此:
With Range("B3:H63")
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($D3="""",FALSE,IF($F3>=$E3,TRUE,FALSE))"
With .FormatConditions(.FormatConditions.Count)
.SetFirstPriority
With .Interior
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
End With
End With
End With