Une macro enregistré ne fonctionne pas : run time error 438
2 réponses
ljaxor
Bonjour,
J'ai enregistré une macro mais elle plante a l'execution.
En fait dans mon fichier excel principal, j'ouvre un fichier txt et je cree
une table de pivot a partir de la worksheet "back_miss_probes".
Le probleme c'est que j'ai toujours l'erreur "run time error 438 , object
doesn't support this property or method" sur la ligne :
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
I suspecte un problem d'active sheet mais je n'arrive pas a la faire marcher.
Sub macrolja()
'Windows("back_miss_probes.txt").Activate
'Sheets("back_miss_probes").Select
'si de décommente les lignes ci-dessus, j'ai "run time error 9, subscript
out of range"
Columns("H:H").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"back_miss_probes!H:H").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable1"
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").SmallGrid = False
With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source")
.Orientation = xlDataField
.Position = 1
End With
Range("B6").Select
Selection.Sort Key1:="R6C2", Order1:=xlDescending, Type:=xlSortValues, _
OrderCustom:=1, Orientation:=xlTopToBottom
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Pivot"
Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Pivot").Range("B6")
ActiveChart.Location Where:=xlLocationAsNewSheet
Sheets("Chart1").Select
Sheets("Chart1").Name = "Pivot_chart"
Application.CommandBars("PivotTable").Visible = False
End Sub
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
isabelle
bonjour ljaxor,
peut être ne faut il pas indiqué la feuille, ActiveSheet.PivotTableWizard TableDestination:Îlls(3, 1)
isabelle
Bonjour,
J'ai enregistré une macro mais elle plante a l'execution. En fait dans mon fichier excel principal, j'ouvre un fichier txt et je cree une table de pivot a partir de la worksheet "back_miss_probes". Le probleme c'est que j'ai toujours l'erreur "run time error 438 , object doesn't support this property or method" sur la ligne : ActiveSheet.PivotTableWizard TableDestination:¬tiveSheet.Cells(3, 1)
I suspecte un problem d'active sheet mais je n'arrive pas a la faire marcher.
Sub macrolja()
'Windows("back_miss_probes.txt").Activate 'Sheets("back_miss_probes").Select 'si de décommente les lignes ci-dessus, j'ai "run time error 9, subscript out of range"
Columns("H:H").Select ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _ "back_miss_probes!H:H").CreatePivotTable TableDestination:="", TableName:= _ "PivotTable1" ActiveSheet.PivotTableWizard TableDestination:¬tiveSheet.Cells(3, 1) ActiveSheet.Cells(3, 1).Select ActiveSheet.PivotTables("PivotTable1").SmallGrid = False With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source") .Orientation = xlDataField .Position = 1 End With Range("B6").Select Selection.Sort Key1:="R6C2", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Sheets("Sheet2").Select Sheets("Sheet2").Name = "Pivot" Charts.Add ActiveChart.SetSourceData Source:=Sheets("Pivot").Range("B6") ActiveChart.Location Where:=xlLocationAsNewSheet Sheets("Chart1").Select Sheets("Chart1").Name = "Pivot_chart" Application.CommandBars("PivotTable").Visible = False End Sub
Voici la macro :
bonjour ljaxor,
peut être ne faut il pas indiqué la feuille,
ActiveSheet.PivotTableWizard TableDestination:Îlls(3, 1)
isabelle
Bonjour,
J'ai enregistré une macro mais elle plante a l'execution.
En fait dans mon fichier excel principal, j'ouvre un fichier txt et je cree
une table de pivot a partir de la worksheet "back_miss_probes".
Le probleme c'est que j'ai toujours l'erreur "run time error 438 , object
doesn't support this property or method" sur la ligne :
ActiveSheet.PivotTableWizard TableDestination:¬tiveSheet.Cells(3, 1)
I suspecte un problem d'active sheet mais je n'arrive pas a la faire marcher.
Sub macrolja()
'Windows("back_miss_probes.txt").Activate
'Sheets("back_miss_probes").Select
'si de décommente les lignes ci-dessus, j'ai "run time error 9, subscript
out of range"
Columns("H:H").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"back_miss_probes!H:H").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable1"
ActiveSheet.PivotTableWizard TableDestination:¬tiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").SmallGrid = False
With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source")
.Orientation = xlDataField
.Position = 1
End With
Range("B6").Select
Selection.Sort Key1:="R6C2", Order1:=xlDescending, Type:=xlSortValues, _
OrderCustom:=1, Orientation:=xlTopToBottom
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Pivot"
Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Pivot").Range("B6")
ActiveChart.Location Where:=xlLocationAsNewSheet
Sheets("Chart1").Select
Sheets("Chart1").Name = "Pivot_chart"
Application.CommandBars("PivotTable").Visible = False
End Sub
peut être ne faut il pas indiqué la feuille, ActiveSheet.PivotTableWizard TableDestination:Îlls(3, 1)
isabelle
Bonjour,
J'ai enregistré une macro mais elle plante a l'execution. En fait dans mon fichier excel principal, j'ouvre un fichier txt et je cree une table de pivot a partir de la worksheet "back_miss_probes". Le probleme c'est que j'ai toujours l'erreur "run time error 438 , object doesn't support this property or method" sur la ligne : ActiveSheet.PivotTableWizard TableDestination:¬tiveSheet.Cells(3, 1)
I suspecte un problem d'active sheet mais je n'arrive pas a la faire marcher.
Sub macrolja()
'Windows("back_miss_probes.txt").Activate 'Sheets("back_miss_probes").Select 'si de décommente les lignes ci-dessus, j'ai "run time error 9, subscript out of range"
Columns("H:H").Select ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _ "back_miss_probes!H:H").CreatePivotTable TableDestination:="", TableName:= _ "PivotTable1" ActiveSheet.PivotTableWizard TableDestination:¬tiveSheet.Cells(3, 1) ActiveSheet.Cells(3, 1).Select ActiveSheet.PivotTables("PivotTable1").SmallGrid = False With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable1").PivotFields("shadow source") .Orientation = xlDataField .Position = 1 End With Range("B6").Select Selection.Sort Key1:="R6C2", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Sheets("Sheet2").Select Sheets("Sheet2").Name = "Pivot" Charts.Add ActiveChart.SetSourceData Source:=Sheets("Pivot").Range("B6") ActiveChart.Location Where:=xlLocationAsNewSheet Sheets("Chart1").Select Sheets("Chart1").Name = "Pivot_chart" Application.CommandBars("PivotTable").Visible = False End Sub
Voici la macro :
ljaxor
Merci pour l'idée. En fait, j'ai réussi a la faire marcher en indiquant a chaque ligne les references completes : Ex Application.Workbooks("back_miss_probes.txt").Sheets("Pivot").PivotTables("PivotTable3").SmallGrid = False
Laurent
Merci pour l'idée.
En fait, j'ai réussi a la faire marcher en indiquant a chaque ligne les
references completes :
Ex
Application.Workbooks("back_miss_probes.txt").Sheets("Pivot").PivotTables("PivotTable3").SmallGrid = False
Merci pour l'idée. En fait, j'ai réussi a la faire marcher en indiquant a chaque ligne les references completes : Ex Application.Workbooks("back_miss_probes.txt").Sheets("Pivot").PivotTables("PivotTable3").SmallGrid = False