Hi all,
I have a sheet which has an external database connection (Don't know if that is relevant or not)
Within my sheet are a number of Pivot Tables, which I have to manually change the filters on them all when I want to change the data set that I am looking at. Attached is the VBA recorder for when I change the weeks to 2015 1/2/3/4/5 & 2016 1/2/3/4/5. What I would like to do, is have a separate feeder page which has a list (In this instance 2015 1, 2015 2, 2015 3 etc) and hitting a button then updated the filter with this selection. The selection will not always be constant, it could be 6 x dates, it could be 8 it could be 10, so could do with the code being able to handle dynamic range lengths.
I know that I could link each
to a cell/s, but this wont allow me to change the number of filter selections in my feeder sheet.
I would also like this to take effect on every sheet within the workbook at the same time.
Thanks in advance
Daz
I have a sheet which has an external database connection (Don't know if that is relevant or not)
Within my sheet are a number of Pivot Tables, which I have to manually change the filters on them all when I want to change the data set that I am looking at. Attached is the VBA recorder for when I change the weeks to 2015 1/2/3/4/5 & 2016 1/2/3/4/5. What I would like to do, is have a separate feeder page which has a list (In this instance 2015 1, 2015 2, 2015 3 etc) and hitting a button then updated the filter with this selection. The selection will not always be constant, it could be 6 x dates, it could be 8 it could be 10, so could do with the code being able to handle dynamic range lengths.
Code:
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Dim Date].[YearWeek].[Dim Date Week]").VisibleItemsList = Array( _
"[Dim Date].[YearWeek].[Dim Date Week].&[1]&[2015]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[2]&[2015]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[3]&[2015]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[4]&[2015]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[5]&[2015]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[1]&[2016]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[2]&[2016]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[3]&[2016]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[4]&[2016]", _
"[Dim Date].[YearWeek].[Dim Date Week].&[5]&[2016]")
I know that I could link each
Code:
&[1]&[2015]
I would also like this to take effect on every sheet within the workbook at the same time.
Thanks in advance
Daz