Chart Help

R

Raul

I have a routine which prompts a user for several ranges
of data (one range is for the data and the other range is
for the x-axis labels) to chart and then creates a 3D
surface chart. The problem is I cannot set the chart's
Category (X) axis labels.

The chart object is called NewChart, and I get an "Unable
to set the XValues property of the series class" error
when I use

NewChart.SeriesCollection(1).XValues = XValRange

to set the category (X) axis labels.

The odd thing is I use the same methodology in another
routine which is working.

Any suggestions?

Thanks,
Raul
 
J

Jon Peltier

Raul -

That's not really enough code to allow a diagnostic. Does your other
routine create the same chart type? Are the commands in the same order?

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

Raul

Jon,
The commands were in the same order but the chart types
were different. The ChartType was xlLineMarkers in the
code that worked, and xlSurface in the code that didn't.

Thanks to your suggestion, I was able to work around the
problem by creating the chart with ChartType =
xlLineMarkers and assigning the XValues and then changing
the ChartType to xlSurface as one of the last steps.

I know it isn't a terribly elegant solution, but it is
reasonably effective.

I appreciate the suggestions.

Thanks again,
Raul
 
J

Jon Peltier

Raul -

When it comes to Excel, especially Excel charts, elegance is not a
requirement. What works on one chart type may choke for another.

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