ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Chart Building - "Unable to set the ... property of the Se (https://www.excelbanter.com/excel-programming/379703-re-dynamic-chart-building-unable-set-property-se.html)

Jon Peltier

Dynamic Chart Building - "Unable to set the ... property of the Se
 
What do these strings look like? Are they valid for this use?
strPrefix & SeriesStartRow & "C" & SeriesColumn
strPrefix & SeriesStartRow & "C" & XValueColumn & ":R" & SeriesEndRow & "C"
& XValueColumn
strPrefix & SeriesStartRow & "C" & DataColumn & ":R" & SeriesEndRow & "C" &
DataColumn

What kind of chart is it? What is the initial source data? Valid numbers and
labels, or blanks, or what?

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


"Dale Fye" wrote in message
...
I have a function that loops through a dataset and dynamically builds the
chart series for a bunch of charts. 95% of the time, this function works
properly, but occassionally, I get an error that reads "Unable to set the
.... property of the Series class", where the ... represents Name,
XValues,
and Values.

Some of the sheet names contain spaces, so I encapsulated them in single
quotes, which seems to work most of the time.

The code that is generating the problem looks like:

strPrefix = "='" & ActiveSheet.name & "'!R"
ActiveChart.SeriesCollection(SeriesCount).Name = strPrefix &
SeriesStartRow
& "C" & SeriesColumn

ActiveChart.SeriesCollection(SeriesCount).XValues = strPrefix &
SeriesStartRow & "C" & XValueColumn & ":R" & SeriesEndRow & "C" &
XValueColumn

ActiveChart.SeriesCollection(SeriesCount).Values = strPrefix &
SeriesStartRow & "C" & DataColumn & ":R" & SeriesEndRow & "C" & DataColumn


--
Email address is not valid.
Please reply to newsgroup only.




Jon Peltier

Dynamic Chart Building - "Unable to set the ... property of th
 
I think the error may have to do with an invalid reference
in the first data series on a chart.


This is what I was thinking. If you may get this kind of problem, you could
temporarily change the chart type to area or column (which are more tolerant
of bad data than XY or line types), but this may disturb your axis layout.

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


"Dale Fye" wrote in message
...
Jon

Love your site. Have been using it a lot lately to get charting ideas.

This particular function is formatting stacked bar charts.

An example of these property values is :

...Name = "='AC_losses_pct'!R617C4"
..XValues = "='AC_losses_pct'!R617C6:R633C6"
..Values = "='AC_losses_pct'!R617C7:R633C7"

The way my code is written, after selecting a chart, it deletes all of the
data series except the first one (1). I'm keeping that one , because it
appears that the other chart properties (X and Y axis formatting) get lost
if
I delete all of the data series.

After posting this message, I went back into the worksheet, and reset each
of the charts so that their first data series was working properly, and
deleted all of the other series from each chart. When I re-ran the
function,
It worked fine. I think the error may have to do with an invalid
reference
in the first data series on a chart.

Thanks, would appreciate any of your insights.


--
Email address is not valid.
Please reply to newsgroup only.


"Jon Peltier" wrote:

What do these strings look like? Are they valid for this use?
strPrefix & SeriesStartRow & "C" & SeriesColumn
strPrefix & SeriesStartRow & "C" & XValueColumn & ":R" & SeriesEndRow &
"C"
& XValueColumn
strPrefix & SeriesStartRow & "C" & DataColumn & ":R" & SeriesEndRow & "C"
&
DataColumn

What kind of chart is it? What is the initial source data? Valid numbers
and
labels, or blanks, or what?

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


"Dale Fye" wrote in message
...
I have a function that loops through a dataset and dynamically builds
the
chart series for a bunch of charts. 95% of the time, this function
works
properly, but occassionally, I get an error that reads "Unable to set
the
.... property of the Series class", where the ... represents Name,
XValues,
and Values.

Some of the sheet names contain spaces, so I encapsulated them in
single
quotes, which seems to work most of the time.

The code that is generating the problem looks like:

strPrefix = "='" & ActiveSheet.name & "'!R"
ActiveChart.SeriesCollection(SeriesCount).Name = strPrefix &
SeriesStartRow
& "C" & SeriesColumn

ActiveChart.SeriesCollection(SeriesCount).XValues = strPrefix &
SeriesStartRow & "C" & XValueColumn & ":R" & SeriesEndRow & "C" &
XValueColumn

ActiveChart.SeriesCollection(SeriesCount).Values = strPrefix &
SeriesStartRow & "C" & DataColumn & ":R" & SeriesEndRow & "C" &
DataColumn


--
Email address is not valid.
Please reply to newsgroup only.








All times are GMT +1. The time now is 09:33 AM.

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