(VBA) Outline.ShowLevels question

pecosvil

Board Regular
Joined
Apr 13, 2010
Messages
52
Hi there. I have a Workbook with two sheets. One has a bunch of cashflows [Worksheets("I_Deal")] while the other sheet [Worksheets("II_Summary")] is linked to the "I_Deal" worksheet and has summary information and graphs on those cashflows.

"I_Deal" sheet has rows that were grouped. There are three levels. The problem that I have is that when the data in "I_Deal" is grouped at Level 1 (ie, the information is summarized and many rows are not visible) and I activate worksheet "II_Summary", all the graphs look "empty". When I activate worksheet "II_Summary" with the data in "I_Deal" at level 3 (all data expanded and visible), the graphs display correctly.

To solve that problem I started a Macro [located in Sheet(II_Summary)]. The macro is intended to showlevel 3 whenever Sheet "II_Summary" is activated, and return to the previous showlevel whenever Sheet "II_Summary" is Deactivated. I managed to do the first task, but I'm having problems when I try to include the second task. Here you'll find the code. I appreciate any suggestions.

Code:
Option Explicit
Dim i As Integer




Private Sub Worksheet_Activate()
    i = Worksheets("I_Deal").Columns(2).OutlineLevel
    Worksheets("I_Deal").Outline.ShowLevels RowLevels:=3
    Debug.Print Worksheets("I_Deal").Rows(36).OutlineLevel
End Sub


Private Sub Worksheet_Deactivate()
    Worksheets("I_Deal").Outline.ShowLevels RowLevels:=i
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,215,945
Messages
6,127,861
Members
449,411
Latest member
adunn_23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top