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.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

jeveristConnect With a Mentor Commented:
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.

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)"

Forced accept.

EE Admin
All Courses

From novice to tech pro — start learning today.