![]() |
|
|
|
#1
|
|||
|
|||
|
Pocerus, what's the loop for?
I don't see the point to set the source of a chart again and again to the same Range! Can you explain what you are after? |
|
#2
|
||||
|
||||
|
Quite.
Is this what you're looking to do? (all subs rolled into 1): Code:
Sub setDataChart()
Range("A1").Value = 1
Range("A1:A6").DataSeries
With ActiveSheet.Shapes.AddChart
.Chart.ChartType = xlXYScatterSmoothNoMarkers
.Height = 325
.Width = 900
.Top = 120
.Left = 10
Range("B1:FA6").Formula = "=RANDBETWEEN(0,10)"
For i = 2 To 157
.Chart.SetSourceData Source:=Union(Range("A1:A6"), Range("A1:FA6").Columns(i))
Application.ScreenUpdating = True
MsgBox "OK to continue…"
Next i
End With
End Sub
|
|
| Tags |
| seriescollection, setsourcedata, vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Run Time Error '1004' | galkej | Excel | 0 | 02-03-2014 06:39 AM |
Run-time error '1004': Document not saved. The document may be open...
|
doctor_who12 | Excel Programming | 1 | 01-22-2014 04:47 PM |
| paste fails error 1004 in VBA Excel 2010 | mikec | Excel Programming | 17 | 05-08-2013 03:11 PM |
Run time error 1004
|
yonasan | Excel Programming | 3 | 06-12-2012 11:08 PM |
runtime error 1004
|
gbaker | Excel Programming | 11 | 06-06-2012 05:23 AM |