Overkill32
New Member
- Joined
- May 13, 2011
- Messages
- 49
I'm trying to create a scatterplot containing 2 series and using variables that I defined using the same macro. The code i came up with is :
[...]
'Delete the chart's old values
'
Worksheets("GRAPHS").Select
ActiveSheet.ChartObjects("Issuer_Comp").Activate
ActiveChart.ChartArea.ClearContents
'
'Create the new chart using the desired Series'
ActiveChart.SeriesCollection.NewSeries
With ActiveChart.SeriesCollection(1)
.XValues = "=DATA_" & b & "!" & Issuer1M
.SeriesCollection(1).Values = "=DATA_" & b & "!" & Issuer1Y
.SeriesCollection(1).Name = b & " " & i
.SeriesCollection.NewSeries
End With
ActiveChart.SeriesCollection.NewSeries
With ActiveChart.SeriesCollection(2)
.XValues = "=DATA_" & c & "!" & Issuer2M
.SeriesCollection(2).Values = "=DATA_" & c & "!" & Issuer2Y
.SeriesCollection(2).Name = c & " " & j
End With
ActiveChart.ChartTitle.Characters.Text = "Hello World"
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScale = MyDate
.MaximumScaleIsAuto = True
End With
Variables b, c and all the Issuers are strings. Variable i and j are also strings but consisting of numbers.
Each time i get to the bold and underlined line, i get an 1004 application defined or object defined error.
Can anyone help me to fix this little problem plz?
[...]
'Delete the chart's old values
'
Worksheets("GRAPHS").Select
ActiveSheet.ChartObjects("Issuer_Comp").Activate
ActiveChart.ChartArea.ClearContents
'
'Create the new chart using the desired Series'
ActiveChart.SeriesCollection.NewSeries
With ActiveChart.SeriesCollection(1)
.XValues = "=DATA_" & b & "!" & Issuer1M
.SeriesCollection(1).Values = "=DATA_" & b & "!" & Issuer1Y
.SeriesCollection(1).Name = b & " " & i
.SeriesCollection.NewSeries
End With
ActiveChart.SeriesCollection.NewSeries
With ActiveChart.SeriesCollection(2)
.XValues = "=DATA_" & c & "!" & Issuer2M
.SeriesCollection(2).Values = "=DATA_" & c & "!" & Issuer2Y
.SeriesCollection(2).Name = c & " " & j
End With
ActiveChart.ChartTitle.Characters.Text = "Hello World"
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScale = MyDate
.MaximumScaleIsAuto = True
End With
Variables b, c and all the Issuers are strings. Variable i and j are also strings but consisting of numbers.
Each time i get to the bold and underlined line, i get an 1004 application defined or object defined error.
Can anyone help me to fix this little problem plz?