Option Explicit
Sub ACTIVER_FILTRES_ANNEES_1()
Call SET_FILTRES_V1("TCD_BAC", "ANNEE", "LST_ANNEES_1", True)
End Sub
Sub ACTIVER_FILTRES_ANNEES_2()
Call SET_FILTRES_V1("TCD_BAC", "ANNEE", "LST_ANNEES_2", True)
End Sub
Sub ACTIVER_SEG_ANNEES_1()
Call SET_FILTRES_V1("TCD_BAC", "ANNEE", "LST_ANNEES_1", True)
End Sub
Sub ACTIVER_SEG_ANNEES_2()
Call SET_FILTRES_V1("TCD_BAC", "ANNEE", "LST_ANNEES_2", True)
End Sub
Sub ACTIVER_FILTRES_ORIGINE_1()
Call SET_FILTRES_V1("TCD_BAC_2", "ORIGINE_SOCIALE", "LST_ORIGINES_1", True)
End Sub
Sub ACTIVER_FILTRES_ORIGINE_2()
Call SET_FILTRES_V1("TCD_BAC_2", "ORIGINE_SOCIALE", "LST_ORIGINES_2", True)
End Sub
Sub ACTIVER_SEG_ORIGINE_1()
Call SET_FILTRES_V1("TCD_BAC_2", "ORIGINE_SOCIALE", "LST_ORIGINES_1", True)
End Sub
Sub ACTIVER_SEG_ORIGINE_2()
Call SET_FILTRES_V1("TCD_BAC_2", "ORIGINE_SOCIALE", "LST_ORIGINES_2", True)
End Sub
Private Sub SET_FILTRES_V1(hTCD As String, hPivotFields As String, hList As String, hOnOff As Boolean)
Dim sVal As Variant
ActiveSheet.PivotTables(hTCD).PivotFields(hPivotFields).CurrentPage = "(All)"
With ActiveSheet.PivotTables(hTCD).PivotFields(hPivotFields)
For Each sVal In Range(hList)
Debug.Print sVal.Value
.PivotItems(CStr(sVal.Value)).Visible = hOnOff
Next
End With
ActiveSheet.PivotTables(hTCD).PivotCache.Refresh
End Sub
Sub ACTIVER_SEGEMENT_1(hTCD As String, hSegment As String, hList As String, hOnOff As Boolean)
Dim sVal As Variant
With ActiveWorkbook.SlicerCaches(hSegment)
For Each sVal In Range(hList)
Debug.Print sVal.Value
.SlicerItems(CStr(sVal.Value)).Selected = hOnOff
Next
End With
ActiveSheet.PivotTables(hTCD).PivotCache.Refresh
End Sub