p.douglas
08-23-2011, 09:21 AM
Hi,
I'm quite new to VB and I've gotten stuck with this particular problem, despite several internet searches!
I have two columns of data, I'm trying to add the first 7 rows as series one, and the next 7 as series two etc. until I run out of data. I've tried to write some code but it doesn't work:
Dim a As Integer
Dim x As Integer
Sub Graph()
x = 1
a = 1
Do
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""x"""
ActiveChart.SeriesCollection(1).XValues = "='Met1'!$B$a:$B$a+6"
ActiveChart.SeriesCollection(1).Values = "='Met1'!$C$a:$C$a+6"
x = x + 1
a = a + 7
Loop Until a = 456
End Sub
Can anyone help? I would appreciate any pointers with this one as it would take me days to do this 'by hand'
Many thanks
Philippa
I'm quite new to VB and I've gotten stuck with this particular problem, despite several internet searches!
I have two columns of data, I'm trying to add the first 7 rows as series one, and the next 7 as series two etc. until I run out of data. I've tried to write some code but it doesn't work:
Dim a As Integer
Dim x As Integer
Sub Graph()
x = 1
a = 1
Do
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""x"""
ActiveChart.SeriesCollection(1).XValues = "='Met1'!$B$a:$B$a+6"
ActiveChart.SeriesCollection(1).Values = "='Met1'!$C$a:$C$a+6"
x = x + 1
a = a + 7
Loop Until a = 456
End Sub
Can anyone help? I would appreciate any pointers with this one as it would take me days to do this 'by hand'
Many thanks
Philippa