Export (0) Print
Expand All
0 out of 3 rated this helpful - Rate this topic

Chart.ChartWizard Method

Office 2007
Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.

Syntax

expression.ChartWizard(Source, Gallery, Format, PlotBy, CategoryLabels, SeriesLabels, HasLegend, Title, CategoryTitle, ValueTitle, ExtraTitle)

expression   A variable that represents a Chart object.

Parameters

NameRequired/OptionalData TypeDescription
SourceOptionalVariantThe range that contains the source data for the new chart. If this argument is omitted, Microsoft Excel edits the active chart sheet or the selected chart on the active worksheet.
GalleryOptionalVariantOne of the constants of XlChartType specifying the chart type.
FormatOptionalVariantThe option number for the built-in autoformats. Can be a number from 1 through 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.
PlotByOptionalVariantSpecifies whether the data for each series is in rows or columns. Can be one of the following XlRowCol constants: xlRows or xlColumns.
CategoryLabelsOptionalVariantAn integer specifying the number of rows or columns within the source range that contain category labels. Legal values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
SeriesLabelsOptionalVariantAn integer specifying the number of rows or columns within the source range that contain series labels. Legal values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
HasLegendOptionalVariantTrue to include a legend.
TitleOptionalVariantThe chart title text.
CategoryTitleOptionalVariantThe category axis title text.
ValueTitleOptionalVariantThe value axis title text.
ExtraTitleOptionalVariant The series axis title for 3-D charts or the second value axis title for 2-D charts.

Remarks

If Source is omitted and either the selection isn't an embedded chart on the active worksheet or the active sheet isn't an existing chart, this 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.

Visual Basic for Applications
Charts("Chart1").ChartWizard _
    Gallery:=xlLine, _
    HasLegend:=True, CategoryTitle:="Year", ValueTitle:="Sales"



Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.