Results 1 to 2 of 2

Toggle Button to hide/unhide rows based on value

Threaded View

  1. #1
    Registered User
    Join Date
    11-26-2019
    Location
    Florida
    MS-Off Ver
    Professional Plus 2016
    Posts
    54

    Toggle Button to hide/unhide rows based on value

    In column C, I have values of Y and N. I want to hide rows that have a Y in column C. The caption will be "Hide Received", which will be all rows that have a Y in column C. And "Show All" which will show all rows (this will include values with Y and N) I have written the following code, but cannot seem to get it to work.

    Does anybody know how to write the code for this? Many thanks!

    
    Private Sub ToggleButton1_Click()
        With Me
            If .ToggleButton1.Value = False Then
                If .AutoFilterMode Then .UsedRange.AutoFilter
                .ToggleButton1.Caption = "Hide Received"
            Else
                .UsedRange.Columns(3).AutoFilter Field:=1, Criteria1:="<>Y"
                .ToggleButton1.Caption = "Show All"
            End If
        End With
    End Sub
    Last edited by therealaccountant; 11-26-2019 at 12:44 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Toggle Button to hide unhide sheets
    By 95marine in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-14-2017, 04:46 PM
  2. 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
  3. [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
  4. button to toggle hide/unhide columns
    By dbuff in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-03-2013, 07:56 PM
  5. Hide/Unhide Multiple Sets of Columns with Toggle Button
    By Mischief433 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-06-2012, 05:55 AM
  6. 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
  7. How to HIDE/UNHIDE Specific Sheets Using a TOGGLE Button?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-16-2011, 02:58 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