Hans10

New Member
Joined
Jul 22, 2015
Messages
8
I have had posted a similar issue earlier, but it did not solve my problem. Therefore, I try again.

My Pivot table gets data from a OLAP Cube. Using the macrorecorder i got this code by setting a new date in the filter and then update the Pivot table. I can manually change the date and it will update when running the macro again.

Sub Update_pvt1()

With Sheets("pvt 1").PivotTables("Pivottabel1")
.PivotFields("[Dato].[AarMaanedDagH].[Aar]").ClearAllFilters
.CubeFields(47).EnableMultiplePageItems = True
.PivotFields("[Dato].[AarMaanedDagH].[Aar]").VisibleItemsList = Array("")
.PivotFields("[Dato].[AarMaanedDagH].[AarMd]").VisibleItemsList = Array("")
.PivotFields("[Dato].[AarMaanedDagH].[AarMaanedDag]").VisibleItemsList = Array("[Dato].[AarMaanedDagH].[AarMaanedDag].&[20150826]")
.PivotTables("Pivottabel1").PivotCache.Refresh

End With
End Sub

In my case i will always have to update my Pivot table to the day before (yesterday!)


Solution 1: Maybe you can put this in the code in one way or another?

Array("[Dato].[AarMaanedDagH].[AarMaanedDag].&[Format(Date - 1, "YYYYMMDD")]")


Solution 2: The trick where you use a range/cell reference? But the trick has not worked for me in the past!


Be aware that the date in my Cube is formated like this "YYYYMMDD" example "20150827" for today.

Any
suggestions? it has been an ongoing problem and i have many tables that i almost every day wants to update.

Thanks to jorismoerings for showing interest in my previous posted thread.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,215,336
Messages
6,124,330
Members
449,155
Latest member
ravioli44

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