Solved

Expand a single collapsed range in VBA?

Posted on 2013-01-18
4
271 Views
Last Modified: 2013-01-28
Hello - I have a worksheet that can wind up with several collapsed ranges, and in a particular situation, I would like to expand one particular range.

I am already using MyWorksheet.Outline.ShowLevels RowLevels:=x to expand all ranges at once

Should/Could this work on a specified range?

Thanks
0
Comment
Question by:mlagrange
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Shanan212
ID: 38794377
Unfortunately, you cannot reference specific group but rather the levels.

Only way is to ungroup them and re-group them as here

    With Range("B:D").Rows
        .Ungroup
            'Do whatever you want to here
        .Group
    End With

Open in new window

0
 

Author Comment

by:mlagrange
ID: 38794408
Well, I don't want to lose the grouping; I just want to expand
0
 
LVL 13

Accepted Solution

by:
Shanan212 earned 500 total points
ID: 38794617
You will loose the grouping temporarily though...so fast, you wouldnt even realize because macro will

Ungroup
Group back
0
 

Author Comment

by:mlagrange
ID: 38796919
Sorry - I should have described what I needed more clearly.

This spreadsheet loads up records from a database, in several sections, and then groups & collapses the groups.

The user would expand a given group to make changes or additions to individual records in that group, which might then require changes to records in another group.  

I would like to expand just that one group where they might need to make related changes, without losing the expand/collapse capabilty, so they can collapse it again if they want.  

I admit I haven't tried your code; maybe .Ungroup expands, and .Group just groups, without collapsing? I'll give it a shot

Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now