+ Reply to Thread
Results 1 to 9 of 9

VBA code to clear all Slicers and Timeline objects in the current sheet

  1. #1
    Forum Contributor MGadAllah's Avatar
    Join Date
    04-13-2008
    Location
    Sheet1
    MS-Off Ver
    365,2307,16.0.16626.20170,64bit
    Posts
    190

    VBA code to clear all Slicers and Timeline objects in the current sheet

    Hi,
    I do not know a lot about VBA.
    I want to clear all filters from the current sheet only for all slicers and timeline objects.
    Please Login or Register  to view this content.
    I googled a lot of links but do not know how to apply them:
    https://www.codevba.com/excel/SlicerCache.htm
    https://learn.microsoft.com/en-us/of...learallfilters
    https://learn.microsoft.com/en-us/of...ecommendations
    Thanks
    Last edited by MGadAllah; 12-07-2022 at 06:08 PM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    Welcome (back) to the forum.

    Thanks for your question. However, we have just found out that you have posted the same question elsewhere.... and haven't told us. Feel free to cross-post on other sites...

    But. Every forum has its rules. Please see Forum Rule #3 about cross-posting. So.

    Do not keep it a secret. We all are willing to give you our time, freely. However, some of us get very annoyed if we waste our time developing a solution for you, when you already have a nice solution elsewhere. All we ask is that you show us some respect and tell us:

    1) if you have cross-posted, and

    2) the URL of the cross posts.

    That way, those of us who don't want to waste their time can quickly check to see if you're already happy with another solution.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,026

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    try this

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor MGadAllah's Avatar
    Join Date
    04-13-2008
    Location
    Sheet1
    MS-Off Ver
    365,2307,16.0.16626.20170,64bit
    Posts
    190

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    I am sorry for cross-posting.
    The link for the other thread is here:
    https://www.mrexcel.com/board/thread...8/post-5987347

  5. #5
    Forum Contributor MGadAllah's Avatar
    Join Date
    04-13-2008
    Location
    Sheet1
    MS-Off Ver
    365,2307,16.0.16626.20170,64bit
    Posts
    190

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    Thanks for replying to me.
    Is it possible to only clear filters in the currently active sheet and not the whole workbook?
    Also, sometimes the code generates an error titled automation error and closes the excel file all of the sudden, and that happened if I run the macro while no filter is selected.
    Thanks

  6. #6
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,026

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    This checks the slicercache for the workbook but only processes the slicers on the active sheet.

    I'm not getting any errors. You could try replacing
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor MGadAllah's Avatar
    Join Date
    04-13-2008
    Location
    Sheet1
    MS-Off Ver
    365,2307,16.0.16626.20170,64bit
    Posts
    190

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    Thanks a lot, working as needed!

  8. #8
    Forum Contributor MGadAllah's Avatar
    Join Date
    04-13-2008
    Location
    Sheet1
    MS-Off Ver
    365,2307,16.0.16626.20170,64bit
    Posts
    190

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    Thanks a lot my friend!

  9. #9
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,026

    Re: VBA code to clear all Slicers and Timeline objects in the current sheet

    You're welcome. Thanks for the feedback.

+ 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. How to link Timeline and Slicers in pivot table
    By Vincent Katta in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-04-2019, 09:37 AM
  2. Trying to clear all slicers with VBS
    By bcarroll76 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2018, 10:58 AM
  3. Protect Sheet not to amend objects but allow Slicers/timeline
    By Tai1001 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-04-2018, 03:03 PM
  4. Clear Slicers and Timeline at the same time
    By Acousticlife81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2017, 03:15 PM
  5. Timeline does not update other slicers without refresh all being run
    By PFDave in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2017, 01:32 PM
  6. Timeline to filter with Slicers
    By PFDave in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-23-2016, 10:25 AM
  7. [SOLVED] Alteration to current Code to only clear selected Columns
    By hammer2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2016, 02:16 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