yos*_*rry 9 excel vba conditional-formatting
我有一系列应用了条件格式的单元格。
目的是在视觉上区分正值、负值和无变化的值。
如何使用 VBA 检查单元格是否应用了条件格式(例如由于负数而导致单元格的颜色)?
要使用 VBA 检查单元格是否具有条件格式,请使用以下代码
Dim check As Range
Dim condition As FormatCondition
Set check = ThisWorkbook.ActiveSheet.Cells.Range("A1") 'this is the cell I want to check
Set condition = check.FormatConditions(1) 'this will grab the first conditional format
condition. 'an autolist of methods and properties will pop up and
'you can see all the things you can check here
'insert the rest of your checking code here
Run Code Online (Sandbox Code Playgroud)
您可以将上面的部分代码与 foreach 循环结合使用来检查特定范围内的所有条件。
| 归档时间: |
|
| 查看次数: |
12112 次 |
| 最近记录: |