Roderick_E
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 2,051
So, if you have one slicer that controls another, is it possible to force the dependent slicer to scroll to the selection?
It looks like someone tried an answer previously:
https://www.mrexcel.com/forum/excel...-slicer-possible.html?highlight=slicer+scroll
EXAMPLE:
controlling slicer simply A-Z selections
dependent slicer, names which will select all names that begin with letters selected on controlling slicer.
I ALREADY have the selection routine but I need to have the dependent scroll so it's obvious that the selection worked.
Here are my routines:
called....
It looks like someone tried an answer previously:
https://www.mrexcel.com/forum/excel...-slicer-possible.html?highlight=slicer+scroll
EXAMPLE:
controlling slicer simply A-Z selections
dependent slicer, names which will select all names that begin with letters selected on controlling slicer.
I ALREADY have the selection routine but I need to have the dependent scroll so it's obvious that the selection worked.
Here are my routines:
Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Call testslicer
End Sub
called....
Code:
Sub testslicer()
'reset dependent slicer
ActiveWorkbook.SlicerCaches("Slicer_Name").ClearManualFilter
'loop through controlling slicer
For i = 1 To ActiveWorkbook.SlicerCaches("Slicer_Alpha").SlicerItems.Count
'check selection of controlling slicer
If ActiveWorkbook.SlicerCaches("Slicer_Alpha").SlicerItems(i).Selected Then
'loop through dependent slicer
For o = 1 To ActiveWorkbook.SlicerCaches("Slicer_Name").SlicerItems.Count
'if first letter of dependent slicer DOESN'T match selected controlling slicer (must do negative as at least one item must always be selected)
If Left(ActiveWorkbook.SlicerCaches("Slicer_Name").SlicerItems(o).Name, 1) <> ActiveWorkbook.SlicerCaches("Slicer_Alpha").SlicerItems(i).Name Then
'then unselect that item from dependent slicer
ActiveWorkbook.SlicerCaches("Slicer_Name").SlicerItems(o).Selected = False
Else
'otherwise if matches, select item on dependent slicer
ActiveWorkbook.SlicerCaches("Slicer_Name").SlicerItems(o).Selected = True
End If
Next
End If
Next
End Sub