Avatar of jnash67
jnash67

asked on 

Excel VBA - Getting show / hide grouping code to work with more than one nesting level

In https://www.experts-exchange.com/questions/23524127/Excel-VBA-Trap-the-Group-and-Outline-expand-collapse-Show-Detail-Hide-Detail-events.html, zorvek outlines a techique for expanding / contracting groupings in code.  Is there a way to get this to work with a nested level of grouping?
Visual Basic ClassicMicrosoft Excel

Avatar of undefined
Last Comment
jnash67
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

What where you thinking about in terms of the result? If you want to see if any specific row is hidden you can check just that row or group of rows.

Kevin
Avatar of jnash67
jnash67

ASKER

i'm thinking of something like (hope it shows up formatted properly).
 * -----------------------------------------------------------------------------
   |                                                          *------------------                   |
   |                                                           |                       |                   |      


The stars are the pictures tied to GroupClick.  In this case I'm representing columns.

When you hit the top left picture, it properly opens it up.  When you hit the second picture, it doesn't work properly.
I'm assuming the "stars" are your own controls. If so then the only way to do this is to check the columns in that group. If one or more are visible then assume, as Excel does, the group is expanded and collapse it. Only expand it if all columns are hidden.

Kevin
Avatar of jnash67
jnash67

ASKER

Does this mean you have to hard code the ranges of the sub-groups in the code?
I'm not sure...I'm looking at my original solution to see if something more automated can be cooked up...
ASKER CERTIFIED SOLUTION
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of jnash67
jnash67

ASKER

Nice work.
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo