Sub AddChart()
Dim aChart As Chart
ActiveSheet.ChartObjects.Delete
Set aChart = Charts.Add
Set aChart = aChart.Location(Where:=xlLocationAsObject, Name:="Sheet1")
With aChart
.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets("Sheet1").Range("A3:D7"), _
PlotBy:=xlRows
.HasTitle = True
.ChartTitle.Text = "=Sheet1!R3C1"
With .Parent
.Top = Range("F3").Top
.Left = Range("F3").Left
.Name = "MangoesChart"
End With
End With
End Sub
|