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: 3
Default dead chart

Hi,
I want to create a dead chart and use the following code, partly taken
from http://www.vbaexpress.com/forum/arch...php/t-848.html.

In each cell of A2:B45 is
=RAND()
When I execute it, I get the error
Run-time error '1004': Unable to set the XValues property to the Seriees
class

When I put ordered numbers from 1 to 44 in A2:A45 and B2:B45, it works.

Can anybody explain why?
And make it work for unordered data (my real data is not =Rand(), but
measurements).

Thanks,
Claus

Here's the code:

Private Sub CommandButton1_Click()
Dim intSeries As Integer
Dim objChart As ChartObject
'
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("F7")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = Range("A2:A45")
ActiveChart.SeriesCollection(1).Values = Range("B2:B45")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"

For Each objChart In ActiveSheet.ChartObjects
With objChart.Chart
For intSeries = 1 To .SeriesCollection.Count
With .SeriesCollection(intSeries)
.XValues = .XValues
.Values = .Values
.Name = .Name
End With
Next
End With
Next

End Sub
 
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
Dead spot in worksheet palmerte Excel Discussion (Misc queries) 2 July 30th 08 04:47 PM
Brain Dead CBrausa Excel Discussion (Misc queries) 3 August 16th 06 02:50 PM
Brain Dead: Need help with ???? WarrenC Excel Worksheet Functions 3 July 25th 06 08:11 AM
Is ADO dead? quartz[_2_] Excel Programming 4 August 22nd 05 01:04 PM


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

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"