Setting series values on Excel Chart

M

Mark Roberts

Hi

I'm struggling very hard in getting beyond this error when trying to use VB to generate a chart from data previously inserted into the sheet.

Unable to set the Values property of the Series class.

The code works absolutely fine in XL2007 but I am having to port it back to 2003 and the inference is that its empty values that cause it to hiccup - something I cannot avoid.

My code is:

1. Retrieve selected data from database and place it at the top of the sheet

2. Add The Chart

3. Iterate through the data (amount can be variable depending upon user inputs)

For j as integer=1 to dtsales.Rows.Count
Dim myrange as string = .... 'Sets up the 'Sheet1!$B4:$M4' format range depending upon which columns are populated

chart.seriescollection(j).values = myrange 'Error here

Next


Everything I have researched on this point implies that empty values are the culprit. Two options I have tried are to set a named range and to put this against the value but this throws a type mismatch. The other option was to set the chart type of the series to an xcolumncluster and then to set it back after setting the values but this just threw the first error and so seemingly didnt make any difference.

Any help on this problem would be so gratefully received.

Thank you.



Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET - Losing Session - ScaleOut StateServer
http://www.eggheadcafe.com/tutorial...9baa-1338b43edb8c/aspnet--losing-session.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top