View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA Excel Charts

Easier would be to use dynamic defined names to be the source of your data

Insert =Name = Define

Name: XValues
Refersto: =Offset(Sheet1!$A$1,0,0,Count(Sheet1!$A$A),1)

Name: YValues
Refersto: =Offset(Sheet1!$B$1,0,0,Count(Sheet1!$B$B),1)

In the Chart wizard, under data source, for the series specify (or edit this
in the menu when right clicking on the chart)

=WorkbookName.xls!YValues

and for labels
=WorkbookName.xls!XValues

or edit it in the formula bar when selecting the series.

Thus no code needed.

Regards,
Tom Ogilvy



"jNando" wrote in message
...
I have an Excel workbook that has many charts in it. I
would like to create some code that allows me to
automatically manipulate the .Value and .Xvalue of the
active chart's SeriesCollection.
Each month a new data point is added to the chart's source
data and the .Value and .XValue needs to be extended by
one column to the left (the source data is in rows) to
encompass the new data point. Does anyone have an example
of code that could do this?

Thanks,
jNando