Good Morning,
I have below macro code that selects Henkel as a manufacturer in a slicer. However my issue is code takes too long to run. Looks for each manufacturer in slicer and checks for True or False. I was wondering if there is a way to optimize the code where it doesnt take 5 minutes to execute. I have total of 7 slicers and i only want to select Henkel in Manufacturer1 slicer clear all other filters in other slicers. Is there a way to optimize the code to run faster? Thank you.
I have below macro code that selects Henkel as a manufacturer in a slicer. However my issue is code takes too long to run. Looks for each manufacturer in slicer and checks for True or False. I was wondering if there is a way to optimize the code where it doesnt take 5 minutes to execute. I have total of 7 slicers and i only want to select Henkel in Manufacturer1 slicer clear all other filters in other slicers. Is there a way to optimize the code to run faster? Thank you.
Code:
Sub HenkelOnly()
'
' HenkelOnly Macro
'
'
With ActiveWorkbook.SlicerCaches("Slicer_Manufacturer1")
.ClearManualFilter
For Each oSlicerItem In .SlicerItems
If oSlicerItem.Name = "HENKEL" Then
oSlicerItem.Selected = True
Else
oSlicerItem.Selected = False
End If
Next oSlicerItem
End With
End Sub