Clearing Timeline and Slicer Filters

stroffso

Board Regular
Joined
Jul 12, 2016
Messages
160
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the below code which clears the slicer filters fine but for some reason isint working on the timeline filters. Would anyone know what I need to add to clear the timeline filters?

<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Dim cache As SlicerCache

For Each cache In ActiveWorkbook.SlicerCaches
cache.ClearManualFilter
Next cache</code>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi,

This code reset all filters, including timelines

Code:
[LEFT][COLOR=#101094][FONT=Consolas]Sub[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] ResetFilters[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]()[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
  [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]On[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Error[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Resume[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Next[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
  [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]For[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Each[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] wrksheet [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]In[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] ActiveWorkbook[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]Worksheets
    wrksheet[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]ShowAllData [/FONT][/COLOR][COLOR=#858C93][FONT=Consolas]'This works for filtered data not in a table[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
    [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]For[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Each[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] lstobj [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]In[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] wrksheet[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]ListObjects
      [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]If[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] lstobj[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]ShowAutoFilter [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Then[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
        lstobj[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]Range[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]AutoFilter [/FONT][/COLOR][COLOR=#858C93][FONT=Consolas]'Clear filters from a table[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
        lstobj[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]Range[/FONT][/COLOR][COLOR=#303336][FONT=Consolas].[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]AutoFilter [/FONT][/COLOR][COLOR=#858C93][FONT=Consolas]'Add the filters back to the table[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
      [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]End[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]If[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
    [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Next[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#858C93][FONT=Consolas]'Check next worksheet in the workbook[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
  [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Next[/FONT][/COLOR][COLOR=#303336][FONT=Consolas]
[/FONT][/COLOR][COLOR=#101094][FONT=Consolas]End[/FONT][/COLOR][COLOR=#303336][FONT=Consolas] [/FONT][/COLOR][COLOR=#101094][FONT=Consolas]Sub[/FONT][/COLOR][/LEFT]
 
Upvote 0
Otherwise this code should take off the filters of your timelines only
Code:
Sub TimeLineFiltersOff()

 Dim cache As SlicerCache
   On Error Resume Next
        For Each cache In ActiveWorkbook.SlicerCaches
                      cache.ClearDateFilter
        Next cache
   On Error GoTo 0

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top