Solved

Expand a single collapsed range in VBA?

Posted on 2013-01-18
4
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

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…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

734 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