Excel VBA - Expand only part of an outline using VBA

I know how to expand all nodes using Outline.ShowLevels

    Sheet.Outline.ShowLevels RowLevels:=2, columnlevels:=2

How can I expand just a single node but not the others?  Macro recorder doesn't show anything.
jnash67Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jeveristCommented:
Hi jnash67,

If you know the parent node you are looking for you can.  This routine looks for the parent value "OutlineRow" in column B of the ActiveSheet and expands the children below:

Sub ShowOutlineLevel()
Dim ws As Worksheet, rng As Range, cel As Range

Set ws = ActiveSheet
Set rng = ws.Range(ws.[B2], ws.Cells(ws.Rows.Count, "B").End(xlUp))

For Each cel In rng
    If cel = "OutlineRow" Then
        cel.Offset(1).EntireRow.ShowDetail = True
        Exit For
    End If
Next cel

End Sub

Let me know how this works for you.

Jim
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jorge PaulinoIT Pro/DeveloperCommented:
Hi jnash67,

Try to expand just the item that you want using the menu Data - Group and Outline - Hide Detail/Show Detail. You will get something like this that works fine

ExecuteExcel4Macro "SHOW.DETAIL(1,3,FALSE,2)"

jpaulino
0
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.