Pivot Table Slicers. Can I ensure one specific item is always selected?

2

1

I'm using Excel 2013.

As in the title, I have a slicer (connected to a pivot table and pivot chart) and I'd like to make sure one specific item in my slicer is always selected whilst allowing multiple others to be selected (and deselected) at will.

Hypothetically, lets say the items in my slicer are "conforming", "scratched", "dented", "broken", "torn" (etc etc there are many more).

I have my slicer connected to a pivot chart, and my chart only makes sense if the item called "conforming" is always selected, along with one (or more) of the defects.

Is there any way to force the slicer to always have "conforming" selected, whilst allowing the user to select an additional item (or more)?

Thanks in advance!

riro

Posted 2015-04-15T05:11:48.777

Reputation: 21

Answers

1

You can achieve this with a macro.

Put below macro in the sheet that contains the pivottable and update the slicer name and filter item name :)

(you need to refer to the slicer forumla name wich can be seen in Slicer Settings)

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)

    On Error GoTo err_handler 'filter value might not contain any data and this will throuh an error

    Application.EnableEvents = False
    Application.ScreenUpdating = False

    ActiveWorkbook.SlicerCaches("Slicer_Name").SlicerItems("FilterItemName").Selected = True

err_handler:
    Application.EnableEvents = True
    Application.ScreenUpdating = True
    If Err.Number > 0 Then MsgBox "There are no data for the mandatory filter"

End Sub

stine

Posted 2015-04-15T05:11:48.777

Reputation: 51

I never got this to work. It always just gives the error box. No trace of any other solutions online either. – riro – 2017-04-19T02:26:15.973