+ Reply to Thread
Results 1 to 6 of 6

Trigger event on slicer selection update?

  1. #1
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Trigger event on slicer selection update?

    I have a pivot table set up with a few slicers, in a parent/child setup.
    e.g. for cars, the "Brand" would be the parent and the "Model" will be the child.

    The user selects the brand from Slicer_Brand, and then selects the model from Slicer_Model.

    My aim is to clear the filter on the child slicer when the selection in the parent slicer is changed.

    e.g. User selects "McLaren" from Slicer_Brand and then "P1" from Slicer_Model. Data is shown.
    The user then selects "Ferrari" from Slicer_Brand. Data is rightly not shown since the combination "Ferrari P1" does not exist. This is where I would like to reset the filter on Slicer_Model so that all models are selected, ready for reselection by the user.

    I have a line of code that clears the filter [ThisWorkbook.SlicerCaches("Slicer_Model").ClearManualFilter] but I don't know how to trigger it on the event that Slicer_Brand changes selection.

    Does anyone have any ideas? Thanks.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Trigger event on slicer selection update?

    Unfortunately there is no event that traps Slicer selection change.

    What you can do is associate the code to Worksheet_PivotTableUpdate event.

  3. #3
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Trigger event on slicer selection update?

    I have tried your suggestion but unfortunately it also triggers when you change the child slicer.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Trigger event on slicer selection update?

    Hmm... can you upload small sample file (with dummy or sanitized data)?

    You'd need some sort of check to exit sub, but not sure what condition to use without looking at your set up.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Trigger event on slicer selection update?

    Hi,

    You might set up one or more additional pivot tables that only use the child slicer fields, and then monitor that/those for changes.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Trigger event on slicer selection update?

    Quote Originally Posted by xlnitwit View Post
    Hi,

    You might set up one or more additional pivot tables that only use the child slicer fields, and then monitor that/those for changes.
    That is an interesting idea, I can see how that would work.


    However, I have solved the problem in another fashion with the utilisation a UDF used elsewhere in the workbook that returns all the selected slicer items as a CSV string.
    Credit for that particular UDF is http://www.jkp-ads.com/articles/slicers05.asp although my version is slightly modified.

    Here is the code for both my PivotTableUpdate event and the UDF it uses:
    (note that I have two parent slicers)
    Please Login or Register  to view this content.


    Please Login or Register  to view this content.


    Hopefully by posting my solution this will help someone somewhere at somepoint.
    Last edited by Stormin'; 03-22-2017 at 11:50 AM.

+ 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. trigger an event if the cel value changes.
    By yoursamrit2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2015, 06:38 PM
  2. Replies: 8
    Last Post: 08-06-2014, 04:41 AM
  3. [SOLVED] VBA to trigger event change
    By jrholden in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-26-2014, 11:34 AM
  4. Slicer Change Event
    By DuncR6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2013, 04:59 AM
  5. [SOLVED] Trigger Change Event
    By alienware in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-27-2012, 07:25 AM
  6. Slicer Macro - unfilter another slicer on selection
    By chadheins in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2012, 10:41 AM
  7. [SOLVED] Event Trigger
    By lobo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-16-2005, 04:35 PM

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