D
David H.
I am trying to use macros in Excel 2003 to create multiple charts using
several tables of data. All tables are identical, but they contain different
data.
The problem: I have tried repeatedly to record a macro using the relative
reference button so that I can use the same macro across all tables. Even
though the relative reference feature is selected, whenever I run the macro,
I get a chart using the same data that I used to create the macro. If I use
different data in a different table, I still get the original chart.
Can anyone clarify why this is happening? All suggestions would be greatly
appreciated.
Here's the macro:
Sub Macro3()
'
' Macro3 Macro
' Macro recorded 10/15/2004 by David H
'
'
ActiveCell.Range("A1:B7").Select
Charts.Add
ActiveChart.ChartType = xlColumnStacked100
ActiveChart.SetSourceData Source:=Sheets("Q1 - Q5").Range("B39:C45"),
PlotBy _
:=xlRows
ActiveChart.SeriesCollection(1).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(2).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(3).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(4).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(5).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(6).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(7).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.Location Where:=xlLocationAsNewSheet
End Sub
Thanks,
David
several tables of data. All tables are identical, but they contain different
data.
The problem: I have tried repeatedly to record a macro using the relative
reference button so that I can use the same macro across all tables. Even
though the relative reference feature is selected, whenever I run the macro,
I get a chart using the same data that I used to create the macro. If I use
different data in a different table, I still get the original chart.
Can anyone clarify why this is happening? All suggestions would be greatly
appreciated.
Here's the macro:
Sub Macro3()
'
' Macro3 Macro
' Macro recorded 10/15/2004 by David H
'
'
ActiveCell.Range("A1:B7").Select
Charts.Add
ActiveChart.ChartType = xlColumnStacked100
ActiveChart.SetSourceData Source:=Sheets("Q1 - Q5").Range("B39:C45"),
PlotBy _
:=xlRows
ActiveChart.SeriesCollection(1).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(2).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(3).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(4).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(5).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(6).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.SeriesCollection(7).XValues = "='Q1 - Q5'!R38C1"
ActiveChart.Location Where:=xlLocationAsNewSheet
End Sub
Thanks,
David