troubleshooting Question

Macro Change for Reset

Avatar of Bright01
Bright01Flag for United States of America asked on
Microsoft Excel
12 Comments1 Solution351 ViewsLast Modified:
EE Pros,

I have a simple request.  I have two macros that do the following;

1.)  The first macro opens and closes a 2 level outline. Summary and Input (Details).

2.) The second macro presents and sequentially serves up 14 different Ranges that represent subsets within the entire Summary.  The Ranges are named Range1 through Range14 with Range 14 being the entire set of Details.  

Here's what I need.  I need to reset the first Macro so that when it is fired, it will be fired when all of the details are open.  That is to say, none of the individual ranges are showing "individually".

That's it!  I'm thinking its one or two lines in the beginning of the first Macro to reset it.

Thank you in advance,

B.



Private Sub CommandButton1_Click()
 
If CommandButton1.Caption = "Summary" Then
    'Your two macros look the same to me except for the name, but
    'reguardless you would put the name of the one that you want to
    'run when the caption says "Expand" here
    Expand_Summary
    CommandButton1.Caption = "Input"
Else
    Expand_all '????
    CommandButton1.Caption = "Summary"
End If
End Sub



Private Sub CommandButton2_Click()
Const NoOfRanges = 14
Static CurrentRange As Long
Dim I As Long
Application.ScreenUpdating = False

    CurrentRange = (CurrentRange + 1) Mod (NoOfRanges + 1)
   
   
    For I = 1 To NoOfRanges
        Range("Range" & I).EntireRow.Hidden = CurrentRange <> 0
    Next I
   
    If CurrentRange <> 0 Then
        Range("Range" & CurrentRange).EntireRow.Hidden = False
    End If
    Application.ScreenUpdating = True
End Sub
ASKER CERTIFIED SOLUTION
Faustulus

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros