I am trying to clear slicers completely with my code. I have a userform that allows the user to choose their data cut. The slicers are coming from two different data sources .. one with three options and one with two. In order to maintain accuracy when users select the slicers that don't have the option from the other slicer I want the slicer to be completely unselected. Please forgive my amateur code below. I have been piecemealing this together for quiet awhile relying heavily on macro recorder.
"Slicer_Collection_Flag" will end up being blank but "Slicer_Collection_Flag3" does not. Any suggestion are appreciated.
'Show Prestige only
If CheckBox1 = False And CheckBox2 = False And CheckBox3 = True Then
AdrenalineCar.Visible = False
DreamCar.Visible = False
Both.Visible = False
Prestige.Visible = True
Dream_Prestige.Visible = False
All3.Visible = False
Adrenaline_Prestige.Visible = False
With ActiveWorkbook.SlicerCaches("Slicer_Collection_Flag")
.SlicerItems("ADRENALINE").Selected = False
.SlicerItems("DREAM").Selected = False
End With
With ActiveWorkbook.SlicerCaches("Slicer_Collection_Flag1")
.SlicerItems("ADRENALINE").Selected = False
.SlicerItems("DREAM").Selected = False
.SlicerItems("PRESTIGE").Selected = True
End With
With ActiveWorkbook.SlicerCaches("Slicer_Collection_Flag2")
.SlicerItems("ADRENALINE").Selected = False
.SlicerItems("DREAM").Selected = False
.SlicerItems("PRESTIGE").Selected = True
End With
With ActiveWorkbook.SlicerCaches("Slicer_Collection_Flag3")
.SlicerItems("ADRENALINE").Selected = False
.SlicerItems("DREAM").Selected = False
End With
End If
Bookmarks