Thread: dead chart
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Haslauer Claus Haslauer is offline
external usenet poster
 
Posts: 3
Default dead chart

Sorry for my tone.
That was written in a hurry.
I meant to ask if somebody could provide some help to make it work for
unordered data.
Sorry again.


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