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
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