[英]How to get FormatConditions.Formula1 in Excel VBA?
如果用户已将特定条件格式应用于工作表中的特定范围,我需要使用 VBA 检查。
我可以用这个:
If Worksheets(1).Range("B2:B10").FormatConditions(1).Formula1 = the_formula Then
' some code
End If
为此,我需要获取the_formula 。 我对范围应用了条件格式并使用了这个:
Debug.Print Worksheets(1).Range("B2:B10").FormatConditions(1).Formula1
这给了我一个错误。 我哪里做错了?
如果您的范围Formatconditions
不涉及公式并使用“仅格式化高于或低于平均值(以上)的值”,请尝试下一种方法:
If Worksheets(1).Range("B2:B10").FormatConditions(1).AboveBelow = xlAboveAverage Then
' some code...
End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.