+ Reply to Thread
Results 1 to 6 of 6

Outline Showlevel - Current max level as variable?

  1. #1
    Registered User
    Join Date
    02-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Outline Showlevel - Current max level as variable?

    Hi all,

    Firstly, this is a cross post from Mr Excel.

    I'm trying to create a shortcut via a VBA macro to increase and decrease the group level that is currently on show. I have found and written some code to find the maximum level on the active sheet and can therefore expand all levels or collapse all levels at once. To open or close one level at a time I would need to have access to the current maximum level open on the sheet, not the max level in general ... is this possible? Then I could simply set the current max opened level to variable and set the program to increment or decrease this number by one each time.

    I did originally set the level back to 1 as a default and track a variable but this caused problems when switching between different sheets, resulting in many uses of the shortcut sometimes before it actually decreased anything ...

    Any ideas?

    Many thanks.

    Current code.
    Please Login or Register  to view this content.

    A kind of example of what I would like to do ...

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    02-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Outline Showlevel - Current max level as variable?

    Bump ... It's looking more likely that this isn't possible to do ... ?

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Outline Showlevel - Current max level as variable?

    It's difficult to determine what you're hoping to do without seeing a sample workbook alongside your explanation in the initial post. Can you post a sample workbook with any sensitive data altered/removed?

  4. #4
    Registered User
    Join Date
    02-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Outline Showlevel - Current max level as variable?

    I have attached a sample but it's just three sets of grouped data ... The code above returns how many "Group Levels" are on the sheet. In the attachment this would be 4. I would like to find out if there is a way of returning the current max open group. In the attached it would be 2 as I have saved it.

    Let me know if you need any further explanation, but I'm not sure how how else to describe it.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Outline Showlevel - Current max level as variable?

    I've never really used groups in my line of work, so bear with me here, I'm learning... but I think the procedure below will work? It should expand one group level (=more detail) from whatever is currently showing. I think. Let me know if this is the sort of thing you're looking for.

    Please Login or Register  to view this content.
    *EDIT: You can move in the other direction (contract) by changing the last row to ColLevel - 1

  6. #6
    Registered User
    Join Date
    02-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Outline Showlevel - Current max level as variable?

    So simple ... Using the hidden column to skip the check will find only the max opened group ... Very good, works like a charm! Thanks very much for your help :D

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Indent text to extent of hierarchical outline level
    By snapfade in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-21-2013, 03:24 PM
  2. Copying Files to Current Directory and Compiling an Outline
    By mike@lcs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2012, 10:00 AM
  3. [SOLVED] Create Class-level Array Variable
    By Dominicus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2012, 11:21 AM
  4. Declare module level variable using Set statement
    By asha3010 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-24-2010, 05:22 AM
  5. Can I rename outline level buttons?
    By Grimace in forum Excel General
    Replies: 2
    Last Post: 05-19-2010, 05:26 PM
  6. Declare global variable in Application level
    By suman.biswas in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-18-2009, 04:33 AM
  7. Excel Application Level Global Variable
    By wesbird in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2005, 08:05 PM
  8. [SOLVED] Assign Value to Module Level Variable
    By monir in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 03-22-2005, 11:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1