Object Error when VBa-ing Chart

Joined
Feb 21, 2007
Messages
2
Reaction score
0
Hello,

I am trying to create a chart within part of a macro that generates a table from data chosen by a userform, and then uses that data to create a graph. Yet, for some bizarre reason, I'm getting "Error 424: Object Required" at the line labelled below.

Any ideas? Thanks in advance, kindly folk.

These parts are defined earlier:

Let FirstDate = Sheets("Grapher").Cells(2, 28).Value
Let MonthChoice = MonthsBox.Value
Let DateChoice = DateList.Value


then...



GraphRange = Sheets("Grapher").Range(Cells(1, 29), Cells(1 + MonthChoice, 29 + ManagerChoice)).Value
Sheets("Grapher").Range(Cells(1, 29), Cells(1 + MonthChoice, 29 + ManagerChoice)).Select

Charts.Add

ActiveChart.SetSourceData Source:=GraphRange, PlotBy:=xlColumns
ActiveChart.ChartType = xlColumnClustered

For i = 1 To ManagerChoice
ActiveChart.SeriesCollection(i).XValues = "='Data Rel'!R2C29:R" & MonthChoice + 1 & "C1"
Next i
ActiveChart.Location where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
"Performance Relative to BENCHMARK"
End With
ActiveChart.HasDataTable = False
ActiveChart.ChartArea.Select


The Red Part is the part that generates the Error.

Thanks

Stuart
 
Joined
Feb 21, 2007
Messages
2
Reaction score
0
its okay - i got around the problem. Turns out, I had a selected range AND I was trying to set the source data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top