+ Reply to Thread
Results 1 to 7 of 7

Use Toggle Button to filter

  1. #1
    Registered User
    Join Date
    05-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    35

    Use Toggle Button to filter

    hello everyone
    I have a spreadsheet with a column called Category, in each row of the Category column there are values of "D", "W", "M", "O"
    now i would like to have a toggle button display only rows with D and when i un click the toggle button, it displays all the rows

    Thanks for your help
    Last edited by AliGW; 01-04-2018 at 06:16 AM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Help!-Use Toggle Button to filter

    Here is the recorded macro for filtering column A for value "D"

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Help!-Use Toggle Button to filter

    Thanks stnkynts but how do i unfilter everything now

  4. #4
    Registered User
    Join Date
    05-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Help!-Use Toggle Button to filter

    SOLVED:

    Private Sub ToggleButton1_Click()
    If ActiveSheet.AutoFilterMode = True Then
    'autofilter is on...
    ActiveSheet.AutoFilterMode = False
    Else
    'autofilter is not on...
    ActiveSheet.Range("$B$1:$B$500").AutoFilter Field:=1, Criteria1:="D"
    End If
    End Sub

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: SOLVED!Help!-Use Toggle Button to filter

    Glad you were able to figure it out on your own. Please mark the thread as solved.

  6. #6
    Registered User
    Join Date
    01-04-2018
    Location
    India
    MS-Off Ver
    2017
    Posts
    1

    Re: SOLVED!Help!-Use Toggle Button to filter

    I want to control the autofilter to hapen on sheet 1 but the toggle buton is placed in sheet 3 how do i change the code then?
    Private Sub ToggleButton1_Click()
    '
    ' Macro1 Macro
    '

    '
    Columns("A:A").Select
    Selection.AutoFilter
    Sheet3.Range("$A$2:$A$102").AutoFilter Field:=1, Criteria1:="ABC"

    End Sub

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: SOLVED!Help!-Use Toggle Button to filter

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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 & getting the postion of the just pressed button
    By NugentS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2012, 11:58 AM
  2. Excel 2007 : Toggle Button
    By HangMan in forum Excel General
    Replies: 5
    Last Post: 07-13-2010, 08:57 AM
  3. Need help using a toggle button
    By tanktata in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2006, 03:01 PM
  4. Toggle Button
    By Dave_2k5 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2005, 06:05 AM
  5. Adding .xla button for Toggle Calculation Button
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2005, 09:05 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