Modifying the chart type
Modifying the chart type | VBA Excel @ ExcelOptimize.Com
Modifying the chart type | VBA Excel @ ExcelOptimize.Com
Here’s a confusing statement for you: A ChartObject object acts as a container for a Chart object.
To modify a chart with VBA, you don’t have to activate the chart. Rather, the Chart method can return the chart contained in the ChartObject. Are you thoroughly confused yet? The following two procedures have the same effect — they change the chart named Chart 1 to an area chart. The first procedure activates the chart first; the second one doesn’t. The built-in constant xlArea represents an area chart.
To modify a chart with VBA, you don’t have to activate the chart. Rather, the Chart method can return the chart contained in the ChartObject. Are you thoroughly confused yet? The following two procedures have the same effect — they change the chart named Chart 1 to an area chart. The first procedure activates the chart first; the second one doesn’t. The built-in constant xlArea represents an area chart.
Sub ModifyChart1()
ActiveSheet.ChartObjects(“Chart 1”).Activate
ActiveChart.Type = xlArea
End Sub
Sub ModifyChart2()
ActiveSheet.ChartObjects(“Chart 1”).Chart.Type =
xlArea
End Sub

This post placed under VBA Excel , chart, Excel, VBA code by Andrian
Top incoming search terms for this post
You might wanna see also these VBA Excel :
Preventing Users from Inserting More Worksheets -
Preventing Users from Printing a Workbook -
Preventing Save As in a Workbook -
Loading Add-ins Automatically -
Do-Until loop -
Do-While loop -
Nested For-Next -

Leave a Reply