[英]How to delete slicer cache specific to one worksheet?
I have some code that clears the pivot table slicer cache in my workbook. 我有一些代码清除工作簿中的数据透视表切片器缓存。 I have two pivot tables in the workbook and i'd like to modify the code to clear the slicers only on a specific worksheet.
我在工作簿中有两个数据透视表,我想修改代码以仅在特定工作表上清除切片器。 Does anyone know how I can modify to do this?
有谁知道我可以修改以执行此操作?
Dim cache As SlicerCache
For Each cache In ActiveWorkbook.SlicerCaches
If cache.FilterCleared = False Then cache.ClearManualFilter
Next cache
Thank you! 谢谢!
This should point you in the right direction 这应该指向正确的方向
Sub test()
Dim pt As PivotTable
Dim cache As Slicer
For Each pt In ActiveSheet.PivotTables
For Each cache In pt.Slicers
cache.SlicerCache.ClearAllFilters
Next cache
Next pt
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.