Bonjour à tous,
Voici mon souci : Sous excel 2003 Je voudrais créer un TCD sur une feuille nommée, ça me crée bien le tcd mais j'ai un souci avec le rappatriement des champs, voici mon code :
Sub Macrotest()
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"source!R2C2:R17C6").CreatePivotTable TableDestination:= _
"'[test macro.xls]TCD'!R2C2", TableName:="TCDtest", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("TCDtest").AddFields RowFields:= _
"Métier"
With ActiveSheet.PivotTables("TCDtest").PivotFields( _
"Réel 2010")
.Orientation = xlDataField
.Function = xlCount
End With
End Sub
Merci d'avance.
Voici mon souci : Sous excel 2003 Je voudrais créer un TCD sur une feuille nommée, ça me crée bien le tcd mais j'ai un souci avec le rappatriement des champs, voici mon code :
Sub Macrotest()
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"source!R2C2:R17C6").CreatePivotTable TableDestination:= _
"'[test macro.xls]TCD'!R2C2", TableName:="TCDtest", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("TCDtest").AddFields RowFields:= _
"Métier"
With ActiveSheet.PivotTables("TCDtest").PivotFields( _
"Réel 2010")
.Orientation = xlDataField
.Function = xlCount
End With
End Sub
Merci d'avance.