• Y values in XY Scatter Chart? (2000/sp3)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Y values in XY Scatter Chart? (2000/sp3)

    Author
    Topic
    #420175

    I feel like I’m missing the obvious… I have the following code to wipe-out and re-generate a chart (XY Scatter) based on ranges of data.. I have many columns of “X” points, and one column of “Y” points that I want to use for each set of “X” points. I can add all the “X” points, but don’t know where to add the “Y” points? After the routine runs and I go check chart->sourcedata->series tab, all the “Y Values” are set to “={1}”

    thanks!
    ..dane

    Public Sub subPopulateChartDataSeries()
    
        Dim rngXPoints As Range
        Dim serSeries As Series
        
        ' clear the chart datapoints
        While Chart1.SeriesCollection.Count > 0
            Chart1.SeriesCollection(1).Delete
        Wend
        
        ' Add all the new datapoints
        For Each rngXPoints In Range("xpoints").Columns
            Set serSeries = Chart1.SeriesCollection.NewSeries
            serSeries.XValues = rngXPoints
        Next rngXPoints
        
        MsgBox "Number of series in chart: " & Chart1.SeriesCollection.Count
        
    
    End Sub
    
    Viewing 0 reply threads
    Author
    Replies
    • #950632

      You can use the Values property of the series to set the Y values, the same way you set the XValues property.

    Viewing 0 reply threads
    Reply To: Y values in XY Scatter Chart? (2000/sp3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: