LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Chart Control

I'm trying to change a chart in Excel 2003 using VBA. Unfortunately
there's some non-reproducible error that's driving me crazy. I hope
someone here recognizes it.

What I did was to simply record a macro, and go through manually
resetting the chart settings. Then I copied that code to my program and
changed it a bit to have more flexibility. The thing is that it works
perfectly - mostly. Then it will go into stretches of crashing every
time I run it with an error message:

"Run-time error '1004': Unable to set the XValues property of the
Series class"

It does not seem to be my "improvements" to the code which cause the
problem since when my code starts to fail, the original code that the
macro recorder created also fails at the same point. Attached is the
code which runs and/or fails. At the moment it fails at the line marked
with '**** It's frustrating that all the lines above, which are
essentially identical, run ok until it hits the (3).XValues line. Or
sometimes that works and the (4).Values line might fail instead.

Sub MacroRecorderCreated()
ActiveSheet.ChartObjects("Chart 8").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "=Calc!R6C1:R6000C1"
ActiveChart.SeriesCollection(1).Values = "=Calc!R6C5:R6000C5"
ActiveChart.SeriesCollection(2).XValues = "=Calc!R6C1:R6000C1"
ActiveChart.SeriesCollection(2).Values = "=Calc!R6C8:R6000C8"
ActiveChart.SeriesCollection(3).XValues = "=Calc!R6C1:R6000C1" '****
ActiveChart.SeriesCollection(3).Values = "=Calc!R6C12:R6000C12"
ActiveChart.SeriesCollection(4).XValues = "=Calc!R6C1:R6000C1"
ActiveChart.SeriesCollection(4).Values = "=Calc!R6C11:R6000C11"
ActiveChart.SeriesCollection(5).XValues = "=Calc!R6C1:R6000C1"
ActiveChart.SeriesCollection(5).Values = "=Calc!R6C11:R6000C11"
ActiveWindow.Visible = False
Windows("Stochasitcs2.xls").Activate
Range("J13").Select
End Sub

Does any of this look familiar?

Thanks.

Bill
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Process control chart for quality control in exel? Kara Charts and Charting in Excel 2 May 11th 10 05:45 PM
Slider control in chart Les Charts and Charting in Excel 3 August 2nd 07 01:59 PM
ActiveX control with chart Tanihera Charts and Charting in Excel 1 April 11th 06 05:36 PM
API for MS Chart Control bill Charts and Charting in Excel 1 September 12th 05 07:00 PM
ActiveX control for chart Frank Kabel Excel Programming 0 May 26th 04 05:33 PM


All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"