• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Loop within Loop XY scatter chart

vasim

Member
Sub chart_data()

ActiveSheet.ChartObjects("Chart 2").Activate


For m = 1 To 13


ActiveChart.SeriesCollection.NewSeries

ActiveChart.SeriesCollection(m).Name = n 'Range("B28:B40") want this range looped

ActiveChart.SeriesCollection(1).XValues = d 'Range("A43:A55")want this range looped

ActiveChart.SeriesCollection(1).Values = l 'Range("B43:B55")want this range looped


Next m

End Sub


=n, d, l are just my tries, where I am failing.


Any assistance please..
 
Hi ,


I am not clear on what your chart is supposed to be like ; there are 13 points in the range A43:A55 and B43:B55 ; are these to appear as 13 series or just one ?


If it is just one series , then the FOR ... NEXT loop is not required.


Narayan
 
Thanks Narayank,


There are 13 series that I want to plot...


The main reason being I want to show series name for each of the value....
 
Thanks... Solution found


Sub chart_data()

ActiveSheet.ChartObjects("Chart 2").Activate

n = 28

d = 43


For m = 1 To 13


ActiveChart.SeriesCollection.NewSeries

ActiveChart.SeriesCollection(m).Name = Range("B" & n) 'Range("B28:B40")

ActiveChart.SeriesCollection(m).XValues = Range("A" & d) 'Range("A43:A55")

ActiveChart.SeriesCollection(m).Values = Range("B" & d) 'Range("B43:B55")


n = n + 1

d = d + 1

Next m


End Sub
 
Back
Top