Erreur d'execution 1004 -
Résolu
Bertrand_1963
Messages postés
5
Statut
Membre
-
yg_be Messages postés 24281 Date d'inscription Statut Contributeur Dernière intervention -
yg_be Messages postés 24281 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
Je souhaiterai insérer un tableau croisé dynamique par macro dans un fichier.
J'ai créé cette macro en l'enregistrant (je ne suis pas un pro du VBA!)
L'erreur se produit pratiquement à la fin! (j'ai encadré la "position" de l'erreur par erreur d'éxécution 1004)
Je vous remercie par avance
Voici le programme :
Je souhaiterai insérer un tableau croisé dynamique par macro dans un fichier.
J'ai créé cette macro en l'enregistrant (je ne suis pas un pro du VBA!)
L'erreur se produit pratiquement à la fin! (j'ai encadré la "position" de l'erreur par erreur d'éxécution 1004)
Je vous remercie par avance
Voici le programme :
TCD Macro
'
'
Range("M1").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Feuil1!R1C1:R1048576C9", Version:=6).CreatePivotTable TableDestination:= _
"Feuil1!R1C13", TableName:="Tableau croisé dynamique2", DefaultVersion:=6
Sheets("Feuil1").Select
Cells(1, 13).Select
ActiveWorkbook.ShowPivotTableFieldList = True
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Année")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Nom")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
"Nombre" & Chr(10) & "Jouet" & Chr(10) & "Manquant")
.Orientation = xlRowField
.Position = 3
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
"Nombre" & Chr(10) & "BPZ" & Chr(10) & "Manquant")
.Orientation = xlRowField
.Position = 4
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Année")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Nom")
.Orientation = xlPageField
.Position = 1
End With
ActiveSheet.PivotTables("Tableau croisé dynamique2").AddDataField ActiveSheet. _
PivotTables("Tableau croisé dynamique2").PivotFields("Nombre" & Chr(10) & "BPZ" & Chr(10) & "Manquant"), _
"Nombre de Nombre" & Chr(10) & "BPZ" & Chr(10) & "Manquant", xlCount
ActiveSheet.PivotTables("Tableau croisé dynamique2").AddDataField ActiveSheet. _
PivotTables("Tableau croisé dynamique2").PivotFields("Année"), _
"Nombre de Année", xlCount
'erreur d'execution 1004
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
"Nombre de Nombre" & Chr(10) & "BPZ" & Chr(10) & "Manquant")
.Orientation = xlPageField
.Position = 1
'erreur d'execution 1004
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Nom")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
"Nombre" & Chr(10) & "Jouet" & Chr(10) & "Manquant")
.Orientation = xlPageField
.Position = 1
End With
ActiveWindow.SmallScroll ToRight:=2
ActiveWorkbook.ShowPivotTableFieldList = False
End Sub
A voir également:
- Erreur d'execution 1004 -
- Erreur 0x80070643 - Accueil - Windows
- Erreur 4101 france tv - Forum Lecteurs et supports vidéo
- Erreur 4201 france tv ✓ - Forum Réseaux sociaux
- Code erreur f3500-31 ✓ - Forum Bbox Bouygues
- J'aime par erreur facebook notification - Forum Facebook
4 réponses
yg_be
Messages postés
24281
Date d'inscription
Statut
Contributeur
Dernière intervention
Ambassadeur
1 585
bonjour, peux-tu partager ton fichier?
Merci voici le lien
La macro s'appelle TCD (pas très original mais bon!)
https://drive.google.com/file/d/1IYGnXaq93HbPuZgJzaaiRq_oPW1_vbNC/view?usp=sharing
La macro s'appelle TCD (pas très original mais bon!)
https://drive.google.com/file/d/1IYGnXaq93HbPuZgJzaaiRq_oPW1_vbNC/view?usp=sharing
oups! désolé !
Et maintenant?
https://drive.google.com/file/d/1IYGnXaq93HbPuZgJzaaiRq_oPW1_vbNC/view?usp=sharing
Et maintenant?
https://drive.google.com/file/d/1IYGnXaq93HbPuZgJzaaiRq_oPW1_vbNC/view?usp=sharing