I’ve got an OLAP Cube pivot table and it’s got a date filter on so, you select the date you want the data to filter on and it brings up that days data. I was wondering if it’s possible to input a date into one or multiple cells and hit a button and the pivot is filtered by that date. Here is what I have at the so far that works, however the date is fixed to the 02/10/2014:
This bit in bold is the bit I want to automate, I tried this but it didn’t work!
I tried the below and entered ‘2014-10-01T00:00:00’ in cell H1 but it crashes.
Any help would be much appreciated.
Thanks
Code:
Sub DateChange()
ActiveSheet.PivotTables("PivotTable1").PivotFields("[Dates].[CalendarDates]"). _
CurrentPageName = "[Dates].[CalendarDates].[Day].&[[B]2014-10-02[/B]T00:00:00]"
End Sub
This bit in bold is the bit I want to automate, I tried this but it didn’t work!
I tried the below and entered ‘2014-10-01T00:00:00’ in cell H1 but it crashes.
Code:
Sub DateChange()
Dim DateInput As Integer
DateInput = ActiveWorkbook.Sheets("Sheet2").Range("H1").Value
ActiveSheet.PivotTables("PivotTable1").PivotFields("[Dates].[CalendarDates]"). _
CurrentPageName = "[Dates].[CalendarDates].[Day].&[DateInput]"
End Sub
Thanks