miguelangelo
XLDnaute Occasionnel
bonjour à tous,
Voici mon problème, j'ai un TCD qui contient des données globales.
je veux adresser un détail à différentes entités, selon les informations qui les concerne.
j'ai donc un "for next " qui boucle sur mes différentes entités, puis j'indique à mon tcd que le pivot "preferred bu" correspond à la valeur range("a2")
sauf que pour certaines entités, il n'y a pas d'information.
j'aimerai faire un contrôle au préalable sur le tcd avec la valeur contenue dans a2 avant de le faire filtrer. c'est là que je bloque.
j'ai essayé avec isnothing... , avec on error ,
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:="totale" _
).CreatePivotTable TableDestination:=Range("b18"), TableName:="tcd3"
With ActiveSheet.PivotTables("tcd3")
With .PivotFields("YEAR RETREATED"): .Orientation = xlPageField: .Position = 1: End With
With .PivotFields("SUB-SEGMENT"): .Orientation = xlColumnField: .Position = 1: End With
With .PivotFields("PREFERRED BU"): .Orientation = xlPageField: .Position = 3: End With
if isnothing(ActiveSheet.PivotTables("tcd3").PivotFields("PREFERRED BU").CurrentPage = Range("a2").Value) Then
Range("a2") = ""
else
ActiveSheet.PivotTables("tcd3").PivotFields("PREFERRED BU").CurrentPage = Range("a2").Value
end if
Merci de votre aide..
Voici mon problème, j'ai un TCD qui contient des données globales.
je veux adresser un détail à différentes entités, selon les informations qui les concerne.
j'ai donc un "for next " qui boucle sur mes différentes entités, puis j'indique à mon tcd que le pivot "preferred bu" correspond à la valeur range("a2")
sauf que pour certaines entités, il n'y a pas d'information.
j'aimerai faire un contrôle au préalable sur le tcd avec la valeur contenue dans a2 avant de le faire filtrer. c'est là que je bloque.
j'ai essayé avec isnothing... , avec on error ,
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:="totale" _
).CreatePivotTable TableDestination:=Range("b18"), TableName:="tcd3"
With ActiveSheet.PivotTables("tcd3")
With .PivotFields("YEAR RETREATED"): .Orientation = xlPageField: .Position = 1: End With
With .PivotFields("SUB-SEGMENT"): .Orientation = xlColumnField: .Position = 1: End With
With .PivotFields("PREFERRED BU"): .Orientation = xlPageField: .Position = 3: End With
if isnothing(ActiveSheet.PivotTables("tcd3").PivotFields("PREFERRED BU").CurrentPage = Range("a2").Value) Then
Range("a2") = ""
else
ActiveSheet.PivotTables("tcd3").PivotFields("PREFERRED BU").CurrentPage = Range("a2").Value
end if
Merci de votre aide..