Creating a New Chart Using the ChartWizard Method
Sub CreateExampleChartVersionI()
Dim ws As Worksheet
Dim rgChartData As Range
Dim myChart As Chart
Set ws = ThisWorkbook.Worksheets("Sheet1")
Set rgChartData = ws.Range("B1").CurrentRegion
Set myChart = Charts.Add
Set myChart = myChart.Location(xlLocationAsObject, ws.Name)
With myChart
.ChartWizard _
Source:=rgChartData, _
Gallery:=xlColumn, _
Format:=1, _
PlotBy:=xlColumns, _
CategoryLabels:=1, _
SeriesLabels:=1, _
HasLegend:=True, _
Title:="Version I", _
CategoryTitle:="Year", _
ValueTitle:="GDP in billions of $"
End With
Set myChart = Nothing
Set rgChartData = Nothing
Set ws = Nothing
End Sub
Related examples in the same category