View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Macro to change chart references

If you open your chart and click on the series, and from the menu click
Source Data, then click the Series Tab, you will see that the Sheet name
reference is the syntax used.

"Jobe" wrote:

I have a work book that contains 70 graphs that need to be modified. I am
attempting to record a macro that will change the the location of the series
of cells that the chart graphs. The problem is that my macro changes all the
charts to refferance a specific sheet instead of the active sheet. Below is
an exert of the macro. I want to change the 'Test 1 (2)' to the activesheet.

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(1).XValues = "='Test 1 (2)'!R20C1:R54C1"
ActiveChart.SeriesCollection(1).Values = "='Test 1 (2)'!R20C7:R54C7"
ActiveChart.SeriesCollection(2).XValues = "='Test 1 (2)'!R20C1:R54C1"
ActiveChart.SeriesCollection(2).Values = "='Test 1 (2)'!R20C5:R54C5"
ActiveChart.SeriesCollection(3).XValues = "='Test 1 (2)'!R20C1:R54C1"
ActiveChart.SeriesCollection(3).Values = "='Test 1 (2)'!R20C6:R54C6"