almourasel
XLDnaute Occasionnel
salut les amis
j'ai ce code qu fait la synchornisation entre les slicers mais le problème qu'il est un peu lourd , est ce qu il ya un moyen de le modifier pour que son excusion sera plus rapide ?
il consomme de temps qu'on je filtre avec SC3 et SC4.
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Dim sc1 As SlicerCache
Dim sc2 As SlicerCache
Dim SI1 As SlicerItem
Dim sc3 As SlicerCache
Dim sc4 As SlicerCache
Dim SI3 As SlicerItem
' These names come from Slicer Settings dialog box
Set sc1 = ThisWorkbook.SlicerCaches("Slicer_line")
Set sc2 = ThisWorkbook.SlicerCaches("Slicer_line1")
Set sc3 = ThisWorkbook.SlicerCaches("Slicer_Drawg")
Set sc4 = ThisWorkbook.SlicerCaches("Slicer_DRW")
Application.ScreenUpdating = False
Application.EnableEvents = False
sc2.ClearManualFilter
sc4.ClearManualFilter
For Each SI1 In sc1.SlicerItems
sc2.SlicerItems(SI1.Name).Selected = SI1.Selected
Next SI1
For Each SI3 In sc3.SlicerItems
sc4.SlicerItems(SI3.Name).Selected = SI3.Selected
Next SI3
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
j'ai ce code qu fait la synchornisation entre les slicers mais le problème qu'il est un peu lourd , est ce qu il ya un moyen de le modifier pour que son excusion sera plus rapide ?
il consomme de temps qu'on je filtre avec SC3 et SC4.
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Dim sc1 As SlicerCache
Dim sc2 As SlicerCache
Dim SI1 As SlicerItem
Dim sc3 As SlicerCache
Dim sc4 As SlicerCache
Dim SI3 As SlicerItem
' These names come from Slicer Settings dialog box
Set sc1 = ThisWorkbook.SlicerCaches("Slicer_line")
Set sc2 = ThisWorkbook.SlicerCaches("Slicer_line1")
Set sc3 = ThisWorkbook.SlicerCaches("Slicer_Drawg")
Set sc4 = ThisWorkbook.SlicerCaches("Slicer_DRW")
Application.ScreenUpdating = False
Application.EnableEvents = False
sc2.ClearManualFilter
sc4.ClearManualFilter
For Each SI1 In sc1.SlicerItems
sc2.SlicerItems(SI1.Name).Selected = SI1.Selected
Next SI1
For Each SI3 In sc3.SlicerItems
sc4.SlicerItems(SI3.Name).Selected = SI3.Selected
Next SI3
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub