Referring to column or row grouping using VB


J

jday

I have a combination of column & row groupings that I've created on a
worksheet using the Data Group/Ungroup function. When running certain
macros, I want to either expand or collapse these groupings based on my
needs. I cannot figure out how to reference these groupings within my VB
code to ensure the proper rows/columns are hidden/unhidden as necessary. For
example, assuming I have two 'levels' within my column groupings. If I want
to see all columns, I manually select the "1" in my column outline grid to
expand all columns. If I want to hide the secondary columns, I click the "2"
and these columns are hidden. I want to simulate this action using VB. Is
there any way to do this?
 
Ad

Advertisements

P

pickytweety

ActiveSheet.Outline.ShowLevels RowLevels:=2, ColumnLevels:=2
The above code expands all groupings....conversely
ActiveSheet.Outline.ShowLevels RowLevels:=1, ColumnLevels:=1
the above code collapses all groupings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top