Share via


Chart.SetSourceData Method (Excel)

Sets the source data range for the chart.

Syntax

expression .SetSourceData(Source, PlotBy)

expression A variable that represents a Chart object.

Parameters

Name

Required/Optional

Data Type

Description

Source

Required

Range

The range that contains the source data.

PlotBy

Optional

Variant

Specifies the way the data is to be plotted. Can be either of the following XlRowCol constants: xlColumns or xlRows.

Example

This example sets the source data range for chart one.

Charts(1).SetSourceData Source:=Sheets(1).Range("a1:a10"), _ 
 PlotBy:=xlColumns

See Also

Concepts

Chart Object Members

Chart Object