View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Macro to change chart references

s = "'" & Activesheet.Name
ActiveChart.SeriesCollection(1).XValues = "=" & s & "'!R20C1:R54C1"

and so forth.

--
Regards,
Tom Ogilvy



"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"