Set the Values Format Code of Chart Series

Possible Usage Scenarios

You can set the values format code of chart series using the Series.ValuesFormatCode property. This property is not only useful for series that are based on a range inside the worksheet but also works well for series created from an array of values.

Set the Values Format Code of Chart Series

The following sample code adds a series to an empty chart that previously had no series. It adds the series using an array of values. After adding the series, it formats it with the code $#,##0 using the Series.ValuesFormatCode property, and the number 10000 becomes $10,000. The screenshot shows the effect of the code on the sample Excel file and the output Excel file after execution.

todo:image_alt_text

Sample Code