J
johnhildreth
I use the following code to create a line chart. This is a small part
of a much larger macro. In fact, it is but a small part of a
subroutine that is called by an even larger subroutine. The problem is
in referencing the source data for the chart.
Worksheets("Baseline Data").Activate
LastBase = Worksheets("Baseline
Data").Range("A10").End(xlToRight).Column
'
Charts.Add
ActiveChart.ChartType = xlXYScatterLines
With ActiveChart
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = "='Baseline Data'!R10C2:R10C" &
(LastBase - 1)
.SeriesCollection(1).Values = "='Baseline Data'!R54C2:R54C" &
(LastBase - 1)
.SeriesCollection(1).Name = "=""Baseline"""
.SeriesCollection(1).Border.Weight = xlThick
When I run the subroutines, the reference to the "Baseline Data" sheet
doesn't come through. That is the chart source data is
=#REF!R10C11:R10C16. Interestingly, when I step through the code it
works.
Any thoughts?
Thanks,
John
of a much larger macro. In fact, it is but a small part of a
subroutine that is called by an even larger subroutine. The problem is
in referencing the source data for the chart.
Worksheets("Baseline Data").Activate
LastBase = Worksheets("Baseline
Data").Range("A10").End(xlToRight).Column
'
Charts.Add
ActiveChart.ChartType = xlXYScatterLines
With ActiveChart
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = "='Baseline Data'!R10C2:R10C" &
(LastBase - 1)
.SeriesCollection(1).Values = "='Baseline Data'!R54C2:R54C" &
(LastBase - 1)
.SeriesCollection(1).Name = "=""Baseline"""
.SeriesCollection(1).Border.Weight = xlThick
When I run the subroutines, the reference to the "Baseline Data" sheet
doesn't come through. That is the chart source data is
=#REF!R10C11:R10C16. Interestingly, when I step through the code it
works.
Any thoughts?
Thanks,
John