Hi,
I'm making a graph based on variables from a user form. It works, except there is a mystery series, series 4 - which has no name, one value of {1}, and the same X values as the other series - and I have no idea what is making this happen.
Here is the code for the graph, does anyone know why this is happening?
Workbooks("Utilization Metric Data 091120.xls").Activate
ActiveWorkbook.Sheets("Rev_Hdct").Activate
Set RangeX = Range(Cells(2, intSeriesFC), Cells(2, intSeriesTC))
Set Range1 = Range(Cells(intSeriesYrReg1, intSeriesFC), Cells(intSeriesYrReg1, intSeriesTC))
Set Range2 = Range(Cells(intSeriesYrReg2, intSeriesFC), Cells(intSeriesYrReg2, intSeriesTC))
Set Range3 = Range(Cells(intSeriesYrReg3, intSeriesFC), Cells(intSeriesYrReg3, intSeriesTC))
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = RangeX
ActiveChart.SeriesCollection(1).Values = Range1
ActiveChart.SeriesCollection(1).Name = "=""Central"""
ActiveChart.SeriesCollection(2).XValues = RangeX
ActiveChart.SeriesCollection(2).Values = Range2
ActiveChart.SeriesCollection(2).Name = "=""US_East"""
ActiveChart.SeriesCollection(3).XValues = RangeX
ActiveChart.SeriesCollection(3).Values = Range3
ActiveChart.SeriesCollection(3).Name = "=""US_West"""
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Rev/Hdct"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = True
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = True
ActiveChart.DataTable.ShowLegendKey = True
I'm making a graph based on variables from a user form. It works, except there is a mystery series, series 4 - which has no name, one value of {1}, and the same X values as the other series - and I have no idea what is making this happen.
Here is the code for the graph, does anyone know why this is happening?
Workbooks("Utilization Metric Data 091120.xls").Activate
ActiveWorkbook.Sheets("Rev_Hdct").Activate
Set RangeX = Range(Cells(2, intSeriesFC), Cells(2, intSeriesTC))
Set Range1 = Range(Cells(intSeriesYrReg1, intSeriesFC), Cells(intSeriesYrReg1, intSeriesTC))
Set Range2 = Range(Cells(intSeriesYrReg2, intSeriesFC), Cells(intSeriesYrReg2, intSeriesTC))
Set Range3 = Range(Cells(intSeriesYrReg3, intSeriesFC), Cells(intSeriesYrReg3, intSeriesTC))
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = RangeX
ActiveChart.SeriesCollection(1).Values = Range1
ActiveChart.SeriesCollection(1).Name = "=""Central"""
ActiveChart.SeriesCollection(2).XValues = RangeX
ActiveChart.SeriesCollection(2).Values = Range2
ActiveChart.SeriesCollection(2).Name = "=""US_East"""
ActiveChart.SeriesCollection(3).XValues = RangeX
ActiveChart.SeriesCollection(3).Values = Range3
ActiveChart.SeriesCollection(3).Name = "=""US_West"""
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Rev/Hdct"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = True
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = True
ActiveChart.DataTable.ShowLegendKey = True