Consulting

Results 1 to 3 of 3

Thread: Variables and Chart Series

  1. #1

    Variables and Chart Series

    Hi everyone!
    Another question with charts...
    Is it possible to use a variable name or array for the series in the code for creating a chart? I have tried it a few times and always get an error. I am not sure if it is just not possible, or if I am just going about it the wrong way. Thank you!

  2. #2
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Yes, it is possible - can you post some code that isn't working?

  3. #3
    Here is a sample. I want the series to be an array if possible. THANKS!


    Sheets("Sheet6").Select
    Charts.Add
    ActiveChart.ChartType = xlLineMarkers
    ActiveChart.SetSourceData Source:=Sheets("Sheet6").Range("E12")
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(1).XValues = "=Sheet3!R2C1:R55C1"
    ActiveChart.SeriesCollection(1).Values = "=Sheet3!R2C2:R55C2"
    ActiveChart.SeriesCollection(1).Name = "=Sheet3!R1C11"
    ActiveChart.SeriesCollection(2).XValues = "=Sheet3!R2C1:R55C1"
    ActiveChart.SeriesCollection(2).Values = "=Sheet3!R2C12:R55C12"
    ActiveChart.SeriesCollection(2).Name = "=Sheet3!R1C12"

Posting Permissions

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