Solved

Expand a single collapsed range in VBA?

Posted on 2013-01-18
4
291 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

830 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