1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Dim DateDebut1 As String
Dim DateFin1 As String
Dim Pt As PivotTable
Dim Sh As Worksheet
Dim PlageDate As Object, Cel As Range
DateDebut1 = ComboDateDebut.Value
DateFin1 = ComboDateFin.Value
Dim PvtItem As PivotItem
For Each Sh In Worksheets
For Each Pt In Sh.PivotTables
With Pt.PivotFields("[Plage].[Date du TP].[Date du TP]")
For Each PvtItem In .PivotItems
If Not (IsNull(PvtItem.Value) Or IsEmpty(PvtItem.Value) Or IsMissing(PvtItem.Value) Or _
(Trim(PvtItem.Value) = "") Or (Trim(PvtItem.Value) = "(blank)")) Then
If (Format(CDate(PvtItem.Value), "yyyy/mm/dd") <= Format(DateFin1, "yyyy/mm/dd")) And (Format(CDate(PvtItem.Value), "yyyy/mm/dd") <= Format(DateDebut1, "yyyy/mm/dd")) Then
PvtItem.Visible = True
Else
PvtItem.Visible = False
End If
Else
PvtItem.Visible = False
End If
Next
End With
Next
Next
End Sub |
Partager