tuli
Electrical
- Feb 20, 2003
- 16
Hello,
I am trying to create a chart with many plots and would like to do something similar to the code below.
Sub Macro1()
'
Dim R1, R2, R3, R4, R5, R6, R7 As Range
Dim RR(11) As Range
Sheet2.Select
For i = 0 To 11
Set RR(i) = Range(Cells(9, 2 + 9 * i), Cells(209, 2 + 9 * i))
Next i
'
Range(RR(0),RR(1),RR(2),RR(3),RR(4),RR(5),RR(6),RR(7),RR(8),RR(9),RR(10),RR(11)).Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterLinesNoMarkers).Select
ActiveChart.SetSourceData Source:=Range(RR(0),RR(1),RR(2))
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(1).Name = CELLS(8,2)
ActiveChart.FullSeriesCollection(1).XValues = RR(0)
ActiveChart.FullSeriesCollection(1).Values =RR(1)
FOR I=2 TO 11
ActiveChart.FullSeriesCollection(I).Name = CELLS(8,2 + 9 * i)
ActiveChart.FullSeriesCollection(I).XValues = RR(0)
ActiveChart.FullSeriesCollection(I).Values =RR(I)
NEXT I
End Sub
Please advise
Thank you
I am trying to create a chart with many plots and would like to do something similar to the code below.
Sub Macro1()
'
Dim R1, R2, R3, R4, R5, R6, R7 As Range
Dim RR(11) As Range
Sheet2.Select
For i = 0 To 11
Set RR(i) = Range(Cells(9, 2 + 9 * i), Cells(209, 2 + 9 * i))
Next i
'
Range(RR(0),RR(1),RR(2),RR(3),RR(4),RR(5),RR(6),RR(7),RR(8),RR(9),RR(10),RR(11)).Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterLinesNoMarkers).Select
ActiveChart.SetSourceData Source:=Range(RR(0),RR(1),RR(2))
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(1).Name = CELLS(8,2)
ActiveChart.FullSeriesCollection(1).XValues = RR(0)
ActiveChart.FullSeriesCollection(1).Values =RR(1)
FOR I=2 TO 11
ActiveChart.FullSeriesCollection(I).Name = CELLS(8,2 + 9 * i)
ActiveChart.FullSeriesCollection(I).XValues = RR(0)
ActiveChart.FullSeriesCollection(I).Values =RR(I)
NEXT I
End Sub
Please advise
Thank you