I have a date slicer connected to a pivottable and two pivotcharts. I want this slicer to automatically filter to todays date. I recon I have to do this using VBA code, so I
@lars-rotgers Answer over is 100_% correct for cases where there is no pivottable, but for cases where there is a pivottable this is the right solution:
Sub SetTodaysDate()
Dim today As Date
today = Now
Dim todayString As String
todayString = Format$(today, "dd.mm.yyyy")
ThisWorkbook.SlicerCaches("Slicer_Date").ClearManualFilter
ActiveWorkbook.SlicerCaches("Slicer_Date").VisibleSlicerItemsList = Array( _
"[Period].[Date].&[" & todayString & "]")
End Sub
The [Period].[Date]has to correspond to the dimensions etc in your cube.