Bonjour,
Je souhaite cacher ou rendre visible certaines valeurs d'un TCD mais je bloque dans mon code VBA que voici en partie (et on ne se moque pas des débutants) :
' pour recherche s'il existe ou non des valeurs "retards"
Range("EA1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-10],""+1 an"")"
Range("EB1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-11],""+1 mois"")"
Range("EC1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-12],""+2 ans"")"
Range("ED1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-13],""+6 mois"")"
Range("EE1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-14],""-1 mois"")"
Dim R1 As Characters
Dim R2 As Characters
Dim R3 As Characters
Dim R4 As Characters
Dim R5 As Characters
ActiveSheet.PivotTables("Tableau croisé dynamique3").PivotFields("Retards").ClearAllFilters RT1 = "False"
RT2 = "False"
RT3 = "False"
RT4 = "False"
RT5 = "False"
If Sheets("Commandes (suivi des jalons SF)").Range("EA1").Value > 0 Then
RT1 = "True"
End If
If Sheets("Commandes (suivi des jalons SF)").Range("EB1").Value > 0 Then
RT2 = "True"
End If
If Sheets("Commandes (suivi des jalons SF)").Range("EC1").Value > 0 Then
RT3 = "True"
End If
If Sheets("Commandes (suivi des jalons SF)").Range("ED1").Value > 0 Then
RT4 = "True"
End If
If Sheets("Commandes (suivi des jalons SF)").Range("EE1").Value > 0 Then
RT5 = "True"
End If
With ActiveSheet.PivotTables("Tableau croisé dynamique3").PivotFields("Retards")
.PivotItems("+1 an").Visible = RT1
.PivotItems("+1 mois").Visible = RT2
.PivotItems("+2 ans").Visible = RT3
.PivotItems("+6 mois").Visible = RT4
.PivotItems("-1 mois").Visible = RT5
End With
Mais ".PivotItems("-1 mois").Visible = RT1" ne fonctionne pas bien entendu.
MERCI par avance pour votre aide, cordialement, ST