Deselect filter in slicers with VBA

  • Hello!


    I am trying to control the slicers of a pivot chart with Visual Basic. What I've done is to create a Listbox with the 12 months (in Excel, the slicer I have is for the 12 months too).


    The problem I am having: when I start the userform, in Excel slicer there is always one option selected. So for example I choose in userform the last 3 months and it will show also January. (In excel, there is no way to deselect all)


    This is the code I am using to select from Listbox and show in my userform chart:



    This is working good, except for the item which is selected by default.


    I found this code (by Dominic) which SOLVES the problem of default selection:



    This code is written for 3 items in slicers, but what I'm trying to do is to combine it with my listbox code.


    Any help would be greatly appreciated,


    Thanks!

  • Re: Deselect filter in slicers with VBA


    Well, I managed to solve my problem just adding

    Code
    .clearManualFilter


    So the final code:



    Quite simple!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!