• 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.

Creating Multiple Scatterplots Automatically [SOLVED]

ang.ru

New Member
Hi everyone,


I'm currently making around 100 scatterplots for a set of data; is there anyway for excel to automatically make these for me instead of me creating each graph one by one? Here's the link to the data on dropbox for reference:


https://www.dropbox.com/s/q2akvhxbb3cv5og/Workbook20.xlsx


I did the first one as a reference ( x axis is the difference, y axis is the date, and I need one graph for each "set" of serial numbers)


Thanks!!!
 
This assumes you do not have any chartobject already in the sheet

[pre]
Code:
Sub SMC()

Dim lng As Long, lngStart As Long
Dim objChart As ChartObject
lngStart = 2
For lng = 3 To ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
If Cells(lng, 1) <> Cells(lng - 1, 1) Then
Set objChart = ActiveSheet.ChartObjects.Add(Cells(lng, 5).Left, 305 * ActiveSheet.ChartObjects.Count, 500, 300)
With objChart.Chart
.SetSourceData Source:=Range("Sheet1!$B$" & lngStart & ":$C$" & lng - 1)
.ChartType = xlXYScatter
.SeriesCollection(1).Name = "=Sheet1!$A$" & lngStart
End With
lngStart = lng
End If
Next lng

End Sub
[/pre]
 
Back
Top