1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Dim Pvt As PivotItem
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields("DATE")
For i = 1 To .PivotItems.Count
If .PivotItems(i).Name <> Sheets("Onglet1").Cells(6, 9) And .PivotItems(i).Name <> DateAdd("m", -3, Sheets("Onglet1").Cells(6, 9)) Then
MsgBox "masque" & vbCrLf & .PivotItems(i).Name
.PivotItems(i).Visible = False
If .PivotItems(i).Visible Then MsgBox "visible" Else MsgBox "pas visible"
End If
Next i
For i = 1 To .PivotItems.Count
If .PivotItems(i).Name = Sheets("Onglet1").Cells(6, 9) Or .PivotItems(i).Name = DateAdd("m", -3, Sheets("Onglet1").Cells(6, 9)) Then
MsgBox "affiche" & vbCrLf & .PivotItems(i).Name
.PivotItems(i).Visible = True
End If
Next
End With |
Partager