Name
chartobjects.Add(Left, Top, Width, Height)
Synopsis
Creates a blank, embedded chart on the worksheet or chart sheet.
|
Argument |
Settings |
|---|---|
|
|
The distance between the left edge of the sheet and the right edge of the chart in points |
|
|
The distance between the top of the sheet and the top of the chart in points |
|
|
The width of the chart in points |
|
|
The height of the chart in points |
Add does not plot the chart, so use the ChartWizard or SetSourceData methods after you create the chart. The following code shows how to quickly create an embedded chart from a selected range of cells:
Sub AddEmbeddedChart( )
Dim co As ChartObject
' Create the chart object
Set co = ActiveSheet.ChartObjects.Add(100, 200, 400, 200)
' Plot the chart from the selected range.
co.Chart.ChartWizard Selection, xl3DColumn, , xlRows
End SubBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access