Bonjour a tous,
Je suis en train de réaliser une macro qui crée des graphes. Cependant, je souhaiterai que la sélection de données intégre des variables. Voici mon code qui fonctionne :
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A2:B256,F2:F256")
ActiveChart.ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(1).ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(1).AxisGroup = 1
ActiveChart.FullSeriesCollection(2).ChartType = xlLine
ActiveChart.FullSeriesCollection(2).AxisGroup = 1
ActiveChart.FullSeriesCollection(2).AxisGroup = 2
ActiveChart.FullSeriesCollection(1).ChartType = xlLine
ActiveChart.FullSeriesCollection(2).ChartType = xlAreaStacked
Et je souhaiterai un truc dans ce style :
Sheets("Feuil1").Select
a = Range("A1").Value
B = Range("Z1")
ActiveChart.SetSourceData Source:=Sheets("Feuil1").[Surligner]Range("A2:B"&a&",F2:F"&a&"")[/Surligner]
ActiveChart.ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(1).ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(1).AxisGroup = 1
ActiveChart.FullSeriesCollection(2).ChartType = xlLine
ActiveChart.FullSeriesCollection(2).AxisGroup = 1
ActiveChart.FullSeriesCollection(2).AxisGroup = 2
ActiveChart.FullSeriesCollection(1).ChartType = xlLine
ActiveChart.FullSeriesCollection(2).ChartType = xlAreaStacked
Merci de votre aide.