Windows XP Change graph type in VBA

Joined
Sep 2, 2008
Messages
5
Reaction score
0
Hi all,



I woud like to know if it's possible to change a graph's type, by VBA code. For exemple, i would like to change an histogramme graph into a sector's graph.



thanks in advance for all tips,
 
To change the type of chart use similar code. This creates, then changes an existing, selected chart.

'this is the range for my chart data
Range("A1:Q11").Select
'this adds the chart
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:Q11"), PlotBy _
:=xlRows
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
'this selects the existing chart
ActiveChart.ChartArea.Select
'this selects the new chart type
ActiveChart.ChartType = xl3DPie
 
Back
Top