Level 1 is for rows that are not grouped

Rows("1:1").OutlineLevel = 1 

Level 2 is for rows that have been grouped

Rows("1:1").OutlineLevel = 2 

If you add an Outline to rows 5:10 and then add another Outline to rows 5:10

Rows("5:5").OutlineLevel = 3 

for the same rows that have been grouped again

Loop all rows and find the maximum outline level
Loop again all the maximum levels remove one level

If different rows are grouped then they are grouped on the same level
Rows that are grouped need a row below them<\B> to contan the Group Title
If there is no blank row then outlines are joined together.

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext