+ Reply to Thread
Results 1 to 9 of 9

Rows wont unhide using toggle button

Hybrid View

  1. #1
    Registered User
    Join Date
    03-25-2020
    Location
    Houston
    MS-Off Ver
    2003-64bit
    Posts
    9

    Rows wont unhide using toggle button

    Hey guys, I have these toggle buttons that will hide/unhide certain row when pressed. However the only one that seems to work is the one that unhides the first set of rows, the others wont work unless I have the first one pressed and unhidden. Help?

    'Daily
    Private Sub ToggleButton1_Click()
        If ToggleButton1.Value = True Then
             'This area contains the things you want to happen
             'when the toggle button is not depressed
            Rows("6:35").EntireRow.Hidden = False
             
        Else
             'This area contains the things you want to happen
             'when the toggle button is depressed
            Rows("6:35").EntireRow.Hidden = True
        End If
    End Sub
    
    
    'Weekly
    Private Sub ToggleButton3_Click()
        If ToggleButton1.Value = True Then
             'This area contains the things you want to happen
             'when the toggle button is not depressed
            Rows("36:53").EntireRow.Hidden = False
             
        Else
             'This area contains the things you want to happen
             'when the toggle button is depressed
            Rows("36:53").EntireRow.Hidden = True
        End If
    End Sub
    
    
    'Monthly
    Private Sub ToggleButton2_Click()
        If ToggleButton1.Value = True Then
             'This area contains the things you want to happen
             'when the toggle button is not depressed
            Rows("54:64").EntireRow.Hidden = False
             
        Else
             'This area contains the things you want to happen
             'when the toggle button is depressed
            Rows("54:64").EntireRow.Hidden = True
        End If
    End Sub

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Rows wont unhide using toggle button

    Where are the toggle buttons located?

    Have you checked the code is actually running?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-25-2020
    Location
    Houston
    MS-Off Ver
    2003-64bit
    Posts
    9

    Re: Rows wont unhide using toggle button

    The toggle buttons are on the same sheet as the rows I want hidden. And I would assume the code is running if the 1st one is working. After I press the first one the rest fall in line fine. I need them to work individually.

  4. #4
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Rows wont unhide using toggle button

    keep it simple

    Private Sub ToggleButton1_Click()
      Rows("6:35").Hidden = ToggleButton1
    End Sub

  5. #5
    Registered User
    Join Date
    03-25-2020
    Location
    Houston
    MS-Off Ver
    2003-64bit
    Posts
    9

    Re: Rows wont unhide using toggle button

    That actually made neither of them work.

  6. #6
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Rows wont unhide using toggle button

    Private Sub ToggleButton1_Click()
      Rows("6:35").Hidden = ToggleButton1
    End Sub
    Private Sub ToggleButton2_Click()
      Rows("54:64").Hidden = ToggleButton2
    End Sub
    Private Sub ToggleButton3_Click()
      Rows("36:53").Hidden = ToggleButton3
    End Sub

  7. #7
    Registered User
    Join Date
    03-25-2020
    Location
    Houston
    MS-Off Ver
    2003-64bit
    Posts
    9

    Re: Rows wont unhide using toggle button

    Thats odd, not sure what I did wrong but it worked! Anyway to get it working the opposite way? Right now depressed = hidden and not depressed = unhidden

  8. #8
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Rows wont unhide using toggle button

    In your code you refer to the wrong toggle button.

    Private Sub ToggleButton3_Click()
        If ToggleButton1.Value = True Then
    To do the opposite, use Not
     Rows("6:35").Hidden = not ToggleButton1

  9. #9
    Registered User
    Join Date
    03-25-2020
    Location
    Houston
    MS-Off Ver
    2003-64bit
    Posts
    9

    Re: Rows wont unhide using toggle button

    You da man! thanks!

+ 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] Toggle Button to hide/unhide rows with specific value
    By therealaccountant in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2019, 05:07 PM
  2. [SOLVED] Toggle Button to hide/unhide blank rows
    By therealaccountant in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-05-2019, 07:56 PM
  3. [SOLVED] Toggle Button to hide/unhide rows based on value
    By therealaccountant in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2019, 12:40 PM
  4. Need Toggle Button to hide/unhide rows based on cell value in non concurrent rows
    By The Phoenix in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-13-2015, 10:49 AM
  5. [SOLVED] Toggle Button to hide/unhide rows based on value
    By goomblar in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-03-2014, 07:35 AM
  6. [SOLVED] Toggle Button to Unlock Sheet with Set Password and Unhide Rows and Relock Sheet
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2014, 06:16 PM
  7. Using Toggle Button to hide/unhide rows that may change
    By jmpatrick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2011, 09:48 AM

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