+ Reply to Thread
Results 1 to 3 of 3

Using Toggle Button to hide/unhide rows that may change

  1. #1
    Registered User
    Join Date
    06-08-2011
    Location
    Motown
    MS-Off Ver
    Excel 2003
    Posts
    2

    Using Toggle Button to hide/unhide rows that may change

    Hope this makes sense. I'm using Excel 2003 and have created a single-sheet workbook that is used to generate a simple document. There are several sections to the sheet, but I only use some of them to generate the document. So, using the following Toggle Button code, I'm able to hide the sections I don't need, and unhide the ones I do:

    Please Login or Register  to view this content.
    Here's the issue: This is set up to hide/unhide Rows 5 thru 20, and it works great. However, often times I will need to add a bunch of rows. "5:20" will no longer work. I need the Toggle Button's code to automatically update to compensate for the additional rows of data. The problem gets real bad with the Toggle Buttons in the section below the section I've added to. They get quite messy.

    Should I use Named Range's to name each section? The name would stay the same, but the number of rows would change?

    jp
    Last edited by pike; 06-09-2011 at 03:32 AM. Reason: add code tags

  2. #2
    Registered User
    Join Date
    06-08-2011
    Location
    Motown
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Using Toggle Button to hide/unhide rows that may change

    This is what worked..

    CODE:
    Private Sub ToggleButton1_Click()
    If ToggleButton1 Then
    Range("A5").EntireRow.Hidden = True
    Else
    Range("A5").EntireRow.Hidden = False
    End If
    End Sub

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Using Toggle Button to hide/unhide rows that may change

    You could define Named Ranges that will expand as you add rows and then use code like

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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