Hi Nick,
I have a slight problem whereby I dont have a clue where to start.
I have an external source creating a .csv file and I would like to produce a
graph in Excel while the data is being written to the file. All it is, is
Column A being plotted against Column B.
Does any1 know if this can be achieved with VBA???
Sure, and probably without VBA!
Start by getting the data into the workbook, without locking the file. The
easiest way to do that is with Data Import External Data Import Data.
Change the 'Files of Type' to All files, browse to the csv file and OK through
the dialogs. When done, you should end up with both columns in the sheet. If
you want, you can right-click inside the data area, choose 'Data Range
Properties', give it a meaningful name (e.g. qryMyData) and tell it to refresh
every minute or so.
Now create a chart based on the data range. If you'd like the chart to
automatically expand as the new data is added, you can create two named ranges
to link the chart to the data, using Insert Name Define:
Name: ChtA
Refers To: =OFFSET(qryMyData,0,0,,1)
Name: ChtB
Refers To: =OFFSET(qryMyData,0,1,,1)
(Note that the qryMyData defined name is automatically created in the first
step, as the name you gave to the query range).
then use these names in the =SERIES() formula for the chart:
=SERIES("My Data",Book1.xls!ChtA,Book1.xls!ChtB,1)
Regards
Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk