Color by Outline Level (group) in Excel

2019-04-02 01:01发布

问题:

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.

I am trying to use the ActiveCell.OutlineLevel property to use in a ColorByValue filter.

is this possible? or, is there a way to do this via VBA or function?

回答1:

Thanks JMax i got the solution based on your advice!...

1- Add Conditional Formatting Rule into the cell that requires the formatting.

=OutlineLevel(CELL("col",CV1)) = 1

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?