[英]Excel-vba: Conditional Formatting: Cell Style
我正在尝试以这种格式使用.style
函数,但是vba不想使用它。 我只是在错误地使用.style
还是需要使用其他方法为单元格着色?
'Conditional Formatting
.FormatConditions.Delete
.FormatConditions.Add xlErrorsCondition, Formula1:= _
"=IF(" & Cells(SelectedGroup, AreaSelected(2)).Offset(2, 1) & "=""Not Used"",TRUE, _
FALSE)"
.FormatConditions(1).Style = "Bad"
.FormatConditions.Add xlErrorsCondition, Formula1:= _
"=IF(" & Cells(SelectedGroup, AreaSelected(2)).Offset(2, 1) & "=""Used"",TRUE,FALSE)"
.FormatConditions(1).Style = "Good"
样式是Range对象的属性。 为了使用它,您需要结束With语句并将样式应用于Range本身。
https://msdn.microsoft.com/zh-CN/vba/excel-vba/articles/range-style-property-excel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.