Workbook Setup

If multiple pivot tables are based on the same data source, you can
create a slicer, and connect it to one or more of those pivot tables.
However, if there are pivot tables from different data sources, you
can't connect the to the same slicer.

In this example, there is a pivot table based on a table with sales
data, and a slicer for the City field.

The source data has four cities, and we only want Boston and Los
Angeles available in the slicer The slicer shows all the items, and
we can't hide the cities that we don't want to use.

Instead, we'll create another pivot table, with just the short list
of cities, and use programming to change the selections in the main
slicer.

Create a Short List of Cities

Follow these steps to set up the short list of cities.

On a blank worksheet, type the heading, City, and a list with
the two cities, Boston and Los Angeles.

Select a cell in the list, and on the Home tab of the Ribbon,
click Format as Table

.Click on a Table Style

Check the data range, and add a check mark to "My table has
headers"

Click OK, to confirm that you want to create a table.

Build a Pivot Table

If you are using Excel 2013, you can use a slicer on an Excel table.
In Excel 2010 and 2007, you'll have to build a pivot table, based
on the city list, before you can create the slicer.

Follow these steps to build a pivot table.

Select a cell in the short list of cities.

On the Insert tab of the Ribbon, click PivotTable

Select "Existing worksheet" and click in the Location
box

Select a cell on the same worksheet as the list, and click OK

In the pivot table field list, add a check mark to City, to add
it to the pivot table, in the Row area

Add a Slicer

The next step is to add a slicer. In Excel 2013, you can connect
the slicer directly to the table, and in Excel 2007 or 2010, use the
pivot table.

Follow these steps to add the slicer:

Select a cell in the pivot table (2007/2010) or the table (2013).

On the Ribbon's Insert tab, click Slicer

In the Slicer window, add a check mark to City, and click OK

To see the slicer's name, select the slicer, and click Slicer
Settings on the Slicer, Options Ribbon tab. You will use that name
in the code

To test the slicer, click on one of the city names, and the pivot
table will only show that city.

To clear the filter, click the Clear Filter button, at the top
right of the slicer

Add the Worksheet Code

The next step is to add code to the worksheet module, for the sheet
where the short city list is stored.

Right-click on the sheet tab for the city list sheet, and click
View Code

Copy the code below, and paste it onto the sheet's code module.

Change the slicer names, to match the slicer names in your file
(see the slicer name in Slicer Settings)

Move the Slicers

The final step is to move the slicers -- the short list slicer will
go onto the main sheet, beside the original pivot table. The long
slicer will go onto the short list sheet, where it will be updated
by the code.

To move a slicer:

Right-click on the slicer, and click Cut

Select the sheet where you want to put the slicer

Right-click on the worksheet, and click Paste

After moving both the slicers, click on a city in the short city
slicer, and the main pivot table should change, to show only the results
for that city. If you check the slicer on the short list sheet, it
should have changed, to show the same city (or cities) selected.