Bonjour,
jeune novice, je me suis lancé dans la construction d'un programme vba il y a peu.. j'y créer des graphiques qui n'apparaissent pas tel que je voudrais sur ma feuille excel.
je créer plusieur graphique auxquels j'attribue une place bien précise sur ma feuille excel. le probleme c'est que pour que mes graphiques apparaissent la ou je le souhaite, il faut que je les ouvre dans un ordre bien précis..
Par exemple si j'ouvre le graphique 2008 sans avoir au préalable ouvert le graphique 2007 et bien mon graphique 2008 s'affiche n'importe où.. comment faire pour que mon graphique apparaissent sans que cela dépende du graphique précedent,
voici la partie du programme où le probleme se pose :
Ps : j'ai donc fait deux macro pour pouvior choisir quel graphique je désirais faire sortir
Sub Macro_Graphique_Ratios_2007()
Range("A243:A275,B243:B275,J243:J275").Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A243:A275,B243:B275,J243:J275"), PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources issues de la générosité du public"""
ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons collectés"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Ratios des associations en 2007"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations"
.Axes(xlValue, xlPrimary).HasTitle = False
End With
Dim Emplacement As Range
Dim Grph As ChartObject
Set Grph = Feuil1.ChartObjects(1)
Set Emplacement = Range("A291:N340")
With Grph
.Left = Emplacement.Left
.Top = Emplacement.Top
.Height = Emplacement.Height
.Width = Emplacement.Width
End With
ActiveSheet.ChartObjects(1).Activate
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub
Sub Macro_Graphique_Ratios_2008()
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A243:A275,C243:C275,K243:K275"), PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources issues de la générosité du public"""
ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons collectés"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Ratios des associations en 2008"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations"
.Axes(xlValue, xlPrimary).HasTitle = False
End With
Dim Emplacement As Range
Dim Grph As ChartObject
Set Grph = Feuil1.ChartObjects(2)
Set Emplacement = Range("A345:N395")
With Grph
.Left = Emplacement.Left
.Height = Emplacement.Height
.Width = Emplacement.Width
.Top = Emplacement.Top
End With
ActiveSheet.ChartObjects(2).Activate
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
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
michel ou sam
bonjour, si tu déclenche la macro 2008 en 1er, tu ne peux manipuler ce graphique car tu le déclares
Set Grph = Feuil1.ChartObjects(2)
alors qu'il est en réalité ChartObjects(1)
Une fois créé, je te conseille de ne pas quitter le graphe actif pour lui donner toutes ses caractéristiques du style with ActiveChart . . End with
Michel
"milmo" a écrit dans le message de news:
Bonjour, jeune novice, je me suis lancé dans la construction d'un programme vba il y a peu.. j'y créer des graphiques qui n'apparaissent pas tel que je voudrais sur ma feuille excel.
je créer plusieur graphique auxquels j'attribue une place bien précise sur ma feuille excel. le probleme c'est que pour que mes graphiques apparaissent la ou je le souhaite, il faut que je les ouvre dans un ordre bien précis..
Par exemple si j'ouvre le graphique 2008 sans avoir au préalable ouvert le graphique 2007 et bien mon graphique 2008 s'affiche n'importe où.. comment faire pour que mon graphique apparaissent sans que cela dépende du graphique précedent,
voici la partie du programme où le probleme se pose : Ps : j'ai donc fait deux macro pour pouvior choisir quel graphique je désirais faire sortir
Sub Macro_Graphique_Ratios_2007()
Range("A243:A275,B243:B275,J243:J275").Select Charts.Add ActiveChart.ChartType = xlColumnClustered ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A243:A275,B243:B275,J243:J275"), PlotBy:=xlColumns ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources issues de la générosité du public""" ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons collectés""" ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1" With ActiveChart .HasTitle = True .ChartTitle.Characters.Text = "Ratios des associations en 2007" .Axes(xlCategory, xlPrimary).HasTitle = True .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations" .Axes(xlValue, xlPrimary).HasTitle = False End With
Dim Emplacement As Range Dim Grph As ChartObject Set Grph = Feuil1.ChartObjects(1) Set Emplacement = Range("A291:N340") With Grph .Left = Emplacement.Left .Top = Emplacement.Top .Height = Emplacement.Height .Width = Emplacement.Width End With
ActiveSheet.ChartObjects(1).Activate ActiveChart.ChartTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).AxisTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlValue).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With
End Sub
Sub Macro_Graphique_Ratios_2008()
Charts.Add ActiveChart.ChartType = xlColumnClustered ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A243:A275,C243:C275,K243:K275"), PlotBy:=xlColumns ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources issues de la générosité du public""" ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons collectés""" ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1" With ActiveChart .HasTitle = True .ChartTitle.Characters.Text = "Ratios des associations en 2008" .Axes(xlCategory, xlPrimary).HasTitle = True .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations" .Axes(xlValue, xlPrimary).HasTitle = False End With
Dim Emplacement As Range Dim Grph As ChartObject Set Grph = Feuil1.ChartObjects(2) Set Emplacement = Range("A345:N395") With Grph .Left = Emplacement.Left .Height = Emplacement.Height .Width = Emplacement.Width .Top = Emplacement.Top End With
ActiveSheet.ChartObjects(2).Activate ActiveChart.ChartTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).AxisTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlValue).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With End Sub
bonjour,
si tu déclenche la macro 2008 en 1er, tu ne peux manipuler ce graphique car
tu le déclares
Set Grph = Feuil1.ChartObjects(2)
alors qu'il est en réalité ChartObjects(1)
Une fois créé, je te conseille de ne pas quitter le graphe actif pour lui
donner toutes ses caractéristiques
du style
with ActiveChart
.
.
End with
Michel
"milmo" <milmo@domain-xyz.in> a écrit dans le message de news:
raqdnX28tYYJNAXRRVn_vwA@giganews.com...
Bonjour,
jeune novice, je me suis lancé dans la construction d'un programme vba il
y a
peu.. j'y créer des graphiques qui n'apparaissent pas tel que je voudrais
sur ma
feuille excel.
je créer plusieur graphique auxquels j'attribue une place bien précise sur
ma
feuille excel. le probleme c'est que pour que mes graphiques apparaissent
la ou
je le souhaite, il faut que je les ouvre dans un ordre bien précis..
Par exemple si j'ouvre le graphique 2008 sans avoir au préalable ouvert le
graphique 2007 et bien mon graphique 2008 s'affiche n'importe où.. comment
faire
pour que mon graphique apparaissent sans que cela dépende du graphique
précedent,
voici la partie du programme où le probleme se pose :
Ps : j'ai donc fait deux macro pour pouvior choisir quel graphique je
désirais
faire sortir
Sub Macro_Graphique_Ratios_2007()
Range("A243:A275,B243:B275,J243:J275").Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData
Source:=Sheets("Feuil1").Range("A243:A275,B243:B275,J243:J275"),
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources
issues de la générosité du public"""
ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons
collectés"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Ratios des associations en 2007"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations"
.Axes(xlValue, xlPrimary).HasTitle = False
End With
Dim Emplacement As Range
Dim Grph As ChartObject
Set Grph = Feuil1.ChartObjects(1)
Set Emplacement = Range("A291:N340")
With Grph
.Left = Emplacement.Left
.Top = Emplacement.Top
.Height = Emplacement.Height
.Width = Emplacement.Width
End With
ActiveSheet.ChartObjects(1).Activate
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub
Sub Macro_Graphique_Ratios_2008()
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData
Source:=Sheets("Feuil1").Range("A243:A275,C243:C275,K243:K275"),
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources
issues de la générosité du public"""
ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons
collectés"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Ratios des associations en 2008"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations"
.Axes(xlValue, xlPrimary).HasTitle = False
End With
Dim Emplacement As Range
Dim Grph As ChartObject
Set Grph = Feuil1.ChartObjects(2)
Set Emplacement = Range("A345:N395")
With Grph
.Left = Emplacement.Left
.Height = Emplacement.Height
.Width = Emplacement.Width
.Top = Emplacement.Top
End With
ActiveSheet.ChartObjects(2).Activate
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.Size = 11
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub
bonjour, si tu déclenche la macro 2008 en 1er, tu ne peux manipuler ce graphique car tu le déclares
Set Grph = Feuil1.ChartObjects(2)
alors qu'il est en réalité ChartObjects(1)
Une fois créé, je te conseille de ne pas quitter le graphe actif pour lui donner toutes ses caractéristiques du style with ActiveChart . . End with
Michel
"milmo" a écrit dans le message de news:
Bonjour, jeune novice, je me suis lancé dans la construction d'un programme vba il y a peu.. j'y créer des graphiques qui n'apparaissent pas tel que je voudrais sur ma feuille excel.
je créer plusieur graphique auxquels j'attribue une place bien précise sur ma feuille excel. le probleme c'est que pour que mes graphiques apparaissent la ou je le souhaite, il faut que je les ouvre dans un ordre bien précis..
Par exemple si j'ouvre le graphique 2008 sans avoir au préalable ouvert le graphique 2007 et bien mon graphique 2008 s'affiche n'importe où.. comment faire pour que mon graphique apparaissent sans que cela dépende du graphique précedent,
voici la partie du programme où le probleme se pose : Ps : j'ai donc fait deux macro pour pouvior choisir quel graphique je désirais faire sortir
Sub Macro_Graphique_Ratios_2007()
Range("A243:A275,B243:B275,J243:J275").Select Charts.Add ActiveChart.ChartType = xlColumnClustered ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A243:A275,B243:B275,J243:J275"), PlotBy:=xlColumns ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources issues de la générosité du public""" ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons collectés""" ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1" With ActiveChart .HasTitle = True .ChartTitle.Characters.Text = "Ratios des associations en 2007" .Axes(xlCategory, xlPrimary).HasTitle = True .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations" .Axes(xlValue, xlPrimary).HasTitle = False End With
Dim Emplacement As Range Dim Grph As ChartObject Set Grph = Feuil1.ChartObjects(1) Set Emplacement = Range("A291:N340") With Grph .Left = Emplacement.Left .Top = Emplacement.Top .Height = Emplacement.Height .Width = Emplacement.Width End With
ActiveSheet.ChartObjects(1).Activate ActiveChart.ChartTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).AxisTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlValue).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With
End Sub
Sub Macro_Graphique_Ratios_2008()
Charts.Add ActiveChart.ChartType = xlColumnClustered ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A243:A275,C243:C275,K243:K275"), PlotBy:=xlColumns ActiveChart.SeriesCollection(1).Name = "=""Ratio frais d'appel/ressources issues de la générosité du public""" ActiveChart.SeriesCollection(2).Name = "=""Ratio frais d'appel/dons collectés""" ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1" With ActiveChart .HasTitle = True .ChartTitle.Characters.Text = "Ratios des associations en 2008" .Axes(xlCategory, xlPrimary).HasTitle = True .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Associations" .Axes(xlValue, xlPrimary).HasTitle = False End With
Dim Emplacement As Range Dim Grph As ChartObject Set Grph = Feuil1.ChartObjects(2) Set Emplacement = Range("A345:N395") With Grph .Left = Emplacement.Left .Height = Emplacement.Height .Width = Emplacement.Width .Top = Emplacement.Top End With
ActiveSheet.ChartObjects(2).Activate ActiveChart.ChartTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).AxisTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .Size = 12 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlValue).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlCategory).Select Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .Size = 11 .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With End Sub