LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Update Chart data Range with VBA

Hi,

I do have approx 50 charts (with multiple series) in 1 workbook (excel
97) which show monthly data. I would like to update the chart data
range to show always to the last 12 months of data by running once a
month a macro.

I would like to do with VBA and not with named ranges (as the latter
means that I have to re-setup all graphs with named ranges). To do
this I would like to read-out the current XValues and Values of the
SeriesCollection(i) (see below) into a string or range and brake up
the string and alter this to a new range and update the
Seriescollection again.

I have listed below part of the loop to update all charts; but I the
code does not accept the tempString or tempRange as declared below.
However I can set the XValues and Value properties in VBA (also shown
below)

How should I proceed?


Dim tempString As String
Dim tempRange As Range

ActiveSheet.ChartObjects("Chart 15").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.ChartArea.Select
tempString = ActiveChart.SeriesCollection(1).XValues
tempRange = ActiveChart.SeriesCollection(1).XValues



ActiveChart.SeriesCollection(1).XValues = "=Datasheet!R4C19:R4C31"
ActiveChart.SeriesCollection(1).Values =
"=Datasheet!R59C19:R59C31"


Thanks for any help,
Roger
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot update "Chart data range:" Field Tfrup12 Excel Discussion (Misc queries) 2 February 10th 09 03:27 PM
Cannot Update Chart Data Range! Tfrup12 Excel Discussion (Misc queries) 0 February 10th 09 01:58 PM
How do I automatically update a chart range in Excel Quinton Excel Discussion (Misc queries) 1 July 27th 05 12:57 PM
Update Chart data Range with VBA Roger Charts and Charting in Excel 1 April 10th 05 02:07 PM
Dynamic Chart Range and Chart Update ExcelMonkey[_154_] Excel Programming 1 July 6th 04 08:26 PM


All times are GMT +1. The time now is 09:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"