How to get single series chart RRS feed

  • Question

  • Sub test1()
    Dim MyChart As chart
    Dim ChartData As Range
    Set ChartData = ThisWorkbook.Sheets("Shaftdiameter").Range("R6:R9")
    Set MyChart = ThisWorkbook.Sheets("Shaftdiameter").Shapes.AddChart(xlXYScatterLines).chart
    MyChart.SeriesCollection(1).Values = ChartData
    MyChart.SeriesCollection(1).XValues = ThisWorkbook.Sheets("Shaftdiameter").Range("A2:A11")

    Dim imagename As String
    imagename = Application.DefaultFilePath & Application.PathSeparator & "TempChart.gif"
    MyChart.Export Filename:=imagename, FilterName:="GIF"
    UserForm7.Image1.Picture = LoadPicture(imagename)
    LoadPicture (imagename)
    End Sub

    This above code is giving me 4 series. I just want series 1 to be displayed. How to do that?

    Sunday, October 7, 2018 5:52 AM

All replies

  • After creating the chart delete any series, then add new series for each you need, eg

    Dim sr AS Series

    For Each sr In MyChart.SeriesCollection
    Set sr = MyChart.SeriesCollection.NewSeries
    sr.Values = etc

    Monday, October 15, 2018 9:27 PM