ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Chart data ranges (https://www.excelbanter.com/excel-programming/385671-chart-data-ranges.html)

Alan

Chart data ranges
 
I am trying to allow users to plot data for different products on a
single chart. The macro calculates the data ranges and then assigns
the XValues and Values to the appropriate series of the chart by
overwriting the previously assigned series values. Sometimes the macro
works perfectly and the chart is updated; sometimes I get run-time
error 1004: "Unable to set the XValues property of the series class".

I've checked; the selected data range is correct for each product and
the format of the series value that I am trying to assign is
consistent and is in RC format.

Could anyone give me a hint as to what is happening and how to fix
this?

Regards, Alan


Jon Peltier

Chart data ranges
 
What about the data being replaced? If it contains only non-plottable values
(i.e., blanks or errors) then VBA cannot access the Values and XValues in
order to replace them. This is a problem for XY and Line charts, so you
could temporarily change the series type to Area or Column, change the data
range, and change the chart type back.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Alan" wrote in message
oups.com...
I am trying to allow users to plot data for different products on a
single chart. The macro calculates the data ranges and then assigns
the XValues and Values to the appropriate series of the chart by
overwriting the previously assigned series values. Sometimes the macro
works perfectly and the chart is updated; sometimes I get run-time
error 1004: "Unable to set the XValues property of the series class".

I've checked; the selected data range is correct for each product and
the format of the series value that I am trying to assign is
consistent and is in RC format.

Could anyone give me a hint as to what is happening and how to fix
this?

Regards, Alan




Alan

Chart data ranges
 
Thanks Jon. There doesn't seem to be any blanks of errors in the data
but converting from XY to columns and then back again after the ranges
have been changed seems to work a treat. All I can't figure out is
why!?

Alan


Jon Peltier

Chart data ranges
 
Because Excel is like that sometimes.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Alan" wrote in message
ups.com...
Thanks Jon. There doesn't seem to be any blanks of errors in the data
but converting from XY to columns and then back again after the ranges
have been changed seems to work a treat. All I can't figure out is
why!?

Alan





All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com