ChartWizard Method

Applies To

Chart Object.

Description

Modifies the properties of the given chart. Allows a chart to be quickly formatted without setting all the individual properties. This method is non-interactive, and changes only the specified properties.

Syntax

object.ChartWizard(source, gallery, format, plotBy, categoryLabels, seriesLabels, hasLegend, title, categoryTitle, valueTitle, extraTitle)

object

Required. The Chart object.

source

Required if you are creating a chart; the range that contains the source data for the chart. Optional if you are editing an existing chart; the active chart sheet is edited, or the selected chart on the active worksheet is edited.

gallery

Optional. Specifies the chart type (one of xlArea, xlBar, xlColumn, xlLine, xlPie, xlRadar, xlXYScatter, xlCombination, xl3DArea, xl3DBar, xl3DColumn, xl3DLine, xl3DPie, xl3DSurface, or xlDoughnut).

format

Optional. Specifies the option number for the built-in autoformats. Can be a number from 1 to 10, depending on the gallery type. If this argument is omitted, Microsoft Excel chooses a default value based on the gallery type and data source.

plotBy

Optional. Specifies whether the data for each series is in rows or columns (either xlRows or xlColumns).

categoryLabels

Optional. An integer specifying the number of rows or columns within the source range containing category labels. Legal values are from zero to one less than the maximum number of the corresponding categories or series.

seriesLabels

Optional. An integer specifying the number of rows or columns within the source range containing series labels. Legal values are from zero to one less than the maximum number of the corresponding categories or series.

hasLegend

Optional. True to include a legend.

title

Optional. Chart title text.

categoryTitle

Optional. Category axis title text.

valueTitle

Optional. Value axis title text.

extraTitle

Optional. Series axis title for 3-D charts, second value axis title for 2-D charts.

Remarks

If source is omitted and either the selection is not an embedded chart on the active worksheet or the active sheet is not an existing chart, the method fails and an error occurs.

Example

This example reformats Chart1 as a line chart, adds a legend, and adds category and value axis titles.


Charts("Chart1").ChartWizard _
    gallery:=xlLine, _
    hasLegend:=True, categoryTitle:="Year", valueTitle:="Sales"