D
David Adamson
I currently have a chart series that ranges from 0 to 100 (thanks to Jon
Peltier) to reflect years. I can now add another series of data on top of
that. But what I was wondering is how can I change my series so that I can
show only the data for say year 20 to 40.
I have tried changing 'a' to 20 and 'c' to 40 and it retrieves the correct
data but puts the data over year 0 to 19.
Can someone please tell me what I am missing?
Cheers
David
---------------------------
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.Location Where:=xlLocationAsObject, Name:="Spread Data"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
With ActiveChart.Axes(xlCategory)
.MinimumScale = 0
.MaximumScale = 100
.MajorUnit = 10
End With
With ActiveChart.Axes(xlValue)
.MinimumScale = 0
End With
'add new data then delete legend
a = 1
r = 6
With Worksheets("Spread Data")
Set Title_Names1 = .Cells(r, 1)
End With
With ActiveChart
.SeriesCollection.NewSeries
.SeriesCollection(2).Name = Title_Names1
End With
'loop through data and make it update
For c = 1 To 100
With Worksheets("Spread Data")
Set Area_rng1 = Range(.Cells(r, 1 + a), .Cells(r, 2 + c))
End With
With ActiveChart
.SeriesCollection(2).values = Area_rng1
End With
Next c
Peltier) to reflect years. I can now add another series of data on top of
that. But what I was wondering is how can I change my series so that I can
show only the data for say year 20 to 40.
I have tried changing 'a' to 20 and 'c' to 40 and it retrieves the correct
data but puts the data over year 0 to 19.
Can someone please tell me what I am missing?
Cheers
David
---------------------------
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.Location Where:=xlLocationAsObject, Name:="Spread Data"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
With ActiveChart.Axes(xlCategory)
.MinimumScale = 0
.MaximumScale = 100
.MajorUnit = 10
End With
With ActiveChart.Axes(xlValue)
.MinimumScale = 0
End With
'add new data then delete legend
a = 1
r = 6
With Worksheets("Spread Data")
Set Title_Names1 = .Cells(r, 1)
End With
With ActiveChart
.SeriesCollection.NewSeries
.SeriesCollection(2).Name = Title_Names1
End With
'loop through data and make it update
For c = 1 To 100
With Worksheets("Spread Data")
Set Area_rng1 = Range(.Cells(r, 1 + a), .Cells(r, 2 + c))
End With
With ActiveChart
.SeriesCollection(2).values = Area_rng1
End With
Next c