VBA to connect timeline filter with data slicer month filter of another pivot

carid

New Member
Joined
May 29, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello. I have two different tables with pivot tables (in the data model) and pivot charts. One has dates and a timeline slicer. The other has only months. The goal is to connect the timeline from one pivot to the months filter of the other. Can you suggest a vba macro (running as private sub maybe) that recognises the timeline selections and applies them either as filter on the "months" column, or as selections in a hidden "months" data slicer?

I can go as far as detecting the two months selected in the timeline:
frommonth = Month(ActiveWorkbook.SlicerCaches("Timeline_Date").TimelineState.FilterValue1)
tomonth = Month(ActiveWorkbook.SlicerCaches("Timeline_Date").TimelineState.FilterValue2)

How can I then select those months and all months in between in the second pivot?

((If there is a way to avoid vba, thats also fine, however, I could not make the months column work with timeline slicer no matter how I formatted it. Neither did it work to add a third table with dates and months and try to connect the timeline with this and another slicer between the new table and the months one.))

This is an annual spreadsheet so its only for 2022, dates in the timeline are from 01.01.2022 - 31.12.2022.

Thank you!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,655
Messages
6,120,760
Members
448,991
Latest member
Hanakoro

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