Results 1 to 2 of 2

Thread: Adding multiple series to a graph

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Adding multiple series to a graph

    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:

    [VBA]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
    [/VBA]

    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
    Last edited by Bob Phillips; 08-23-2011 at 10:00 AM. Reason: Added VBA tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •