Slicer Scroll to selected

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:
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
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,215,429
Messages
6,124,834
Members
449,192
Latest member
mcgeeaudrey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top