I'm getting an Application-defined or object-defined error on SI.Selected = False. Can anyone help? Everything I've tried based on my research has failed.
VBA Code:
[
Sub TestSlicer()
Dim sC As SlicerCache
Dim sI As SlicerItem
Dim index As Integer
Set sC = ActiveWorkbook.SlicerCaches("Slicer_ReportDt1")
sC.ClearManualFilter
For index = 1 To sC.SlicerCacheLevels.Count
For Each sI In sC.SlicerCacheLevels(index).SlicerItems
If sI.Name = Format$(Date - 1, "yyyy-mm-dd") Then
sI.Selected = True
Else
sI.Selected = False
End If
Next sI
Next index
End Sub
]