Results 1 to 2 of 2

Adding data points to a chart - VBA

This is a discussion on Adding data points to a chart - VBA within the Excel Questions forums, part of the Question Forums category; I am using the following code to add data points to an existing chart. The existing chart is a "scatter ...

  1. #1
    New Member
    Join Date
    Apr 2012
    Posts
    38

    Default Adding data points to a chart - VBA

    I am using the following code to add data points to an existing chart. The existing chart is a "scatter with smooth lines" chart, and I want the added data points to be scatter only, not smooth. The code will add the new data points as "smooth" by default. Anyone know how to adjust this?

    Code:
        
    Set srsNew1 = ActiveChart.SeriesCollection.NewSeries    
    With srsNew1
            .Name = Cells(7, 9).Value
            .XValues = Range(Cells(8, 8), Cells(lastRow2, 8))
            .Values = Range(Cells(8, 9), Cells(lastRow2, 9))
        End With

  2. #2
    New Member
    Join Date
    Apr 2012
    Posts
    38

    Default Re: Adding data points to a chart - VBA

    I think I got it:



    Code:
    Set srsNew1 = ActiveChart.SeriesCollection.NewSeries    With srsNew1 
           .Name = Cells(7, 9).Value 
           .XValues = Range(Cells(8, 8), Cells(lastRow2, 8)) 
           .Values = Range(Cells(8, 9), Cells(lastRow2, 9)) 
       End With 
       
    seriesname = Cells(7, 9).Value
        ActiveChart.SeriesCollection(Cells(7, 9).Value).Select
        Selection.MarkerStyle = 2
        With Selection.Format.Line
            .Visible = False
        End With

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com