问题描述
我想根据excel中的大纲级别更改单元格的颜色,大纲级别是指列分组的级别.
I would like to change the color of a cell based on its outline level in excel, by outline level i mean the level of the column grouping.
我正在尝试使用 ActiveCell.OutlineLevel 属性在 ColorByValue 过滤器中使用.
I am trying to use the ActiveCell.OutlineLevel property to use in a ColorByValue filter.
这可能吗?或者,有没有办法通过 VBA 或函数来做到这一点?
is this possible? or, is there a way to do this via VBA or function?
推荐答案
谢谢 JMax 我根据你的建议得到了解决方案!...
Thanks JMax i got the solution based on your advice!...
1- 在需要格式化的单元格中添加条件格式规则.
1- Add Conditional Formatting Rule into the cell that requires the formatting.
=OutlineLevel(CELL("col",CV1)) = 1
2- 公式引用了一个输出行分组级别的小函数.
2- The formula references a small function that outputs the rows grouping level.
Function OutlineLev(inp As Integer) As Integer
OutlineLev = Columns(inp).OutlineLevel
End Function
谁能找到更优雅的解决方案?
Can anyone find a more elegant solution?
这篇关于Excel 中按大纲级别(组)着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!