Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clear Slicers only on active worksheet

    I use this code all the time, thanks to another forum member!
    Code:
    Sub SlicerReset()
    
    Dim slcr As SlicerCache
    Application.ScreenUpdating = False
       For Each slcr In ActiveWorkbook.SlicerCaches
        
            slcr.ClearManualFilter
        Next slcr
    Application.ScreenUpdating = True
    
    End Sub
    However, I would like to confine it to just the active worksheet or a specific worksheet. Is that possible. Thank you for reading.

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    Cross-posted here, amongst others: http://www.vbaexpress.com/forum/show...cers-Using-VBA
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    New Lounger
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please forgive me. I have read the rules and will abide by them.

  4. #4
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,641
    Thanks
    115
    Thanked 652 Times in 594 Posts
    Tanner,

    If you know the numbers of the slicers (e.g. 2 and 3) on the sheet you want to clear, you could use something like this:

    In a standard module:
    Code:
    Sub SlicerReset()
    Dim slcr As SlicerCache
    Application.ScreenUpdating = False
    For I = 2 To 3
        ActiveWorkbook.SlicerCaches.Item(I).ClearManualFilter
    Next I
    Application.ScreenUpdating = True
    End Sub
    will clear Slicer #2 and Slicer #3. adjust to the slicer item number on the sheet(s) you want to clear.

    HTH,
    Maud

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •