If there's nothing below the data range in the three columns, this works:
Sub MakeAChart()
Charts.Add
ActiveChart.ChartType = xlLineMarkers
With Sheets("Sheet1")
ActiveChart.SetSourceData _
Source:=.Range(.Range("O9"), .Range("Q5000").End(xlUp))
End With
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
End Sub
- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______
John R wrote:
Hi all, I hope somebody can help me !
How would I generate a chart from a varying source range,
which needs to include two different series? using VBA.
Now problem is, the table allows the user to insert and
delete rows from the source range, so how would a macro
recognise that the source had changed and then generate a
bar chart
My first SERIES = SERIES(,calculations!
$O$9:$O$20,calculations!$P$9:$P$20,1), and my second =
=SERIES (, calculations! $O$9: $O$20,calculations! $Q$9:
$Q$20,2),
where the range in "O", contains the dates., and P & Q
contain values generated by formula.
Thanks all for your help
John R