Hello all.
What I am trying to do: Display a graph for a category when a user selects the 'Graph It' button. The graph would contain the dollars spent for that category.
I built the macro so it first deletes the graph displayed and then rebuilds a graph for the category the user selects the button for. The problem is the Chart name changes everytime (Chart 1, Chart 2, etc.).
What can I do to address the chart name issue? Thanks for your help.
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Parent.Delete
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveSheet.Shapes("Chart 10").Name = "Chart 1"
Range("B28").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.Shapes("Chart 1").IncrementLeft -113.4
ActiveSheet.Shapes("Chart 1").IncrementTop 195
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.Shapes("Chart 1").Width = 550.8
ActiveWindow.SmallScroll Down:=12
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "='Roll-up'!$A$6"
ActiveChart.SeriesCollection(1).Values = _
"='Roll-up'!$G$6,'Roll-up'!$J$6,'Roll-up'!$M$6,'Roll-up'!$P$6,'Roll-up'!$S$6"
ActiveChart.SeriesCollection(1).XValues = "='Roll-up'!$B$43:$B$54"
ActiveWindow.LargeScroll ToRight:=-1
ActiveWindow.SmallScroll Down:=-12
What I am trying to do: Display a graph for a category when a user selects the 'Graph It' button. The graph would contain the dollars spent for that category.
I built the macro so it first deletes the graph displayed and then rebuilds a graph for the category the user selects the button for. The problem is the Chart name changes everytime (Chart 1, Chart 2, etc.).
What can I do to address the chart name issue? Thanks for your help.
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Parent.Delete
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveSheet.Shapes("Chart 10").Name = "Chart 1"
Range("B28").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.Shapes("Chart 1").IncrementLeft -113.4
ActiveSheet.Shapes("Chart 1").IncrementTop 195
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.Shapes("Chart 1").Width = 550.8
ActiveWindow.SmallScroll Down:=12
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "='Roll-up'!$A$6"
ActiveChart.SeriesCollection(1).Values = _
"='Roll-up'!$G$6,'Roll-up'!$J$6,'Roll-up'!$M$6,'Roll-up'!$P$6,'Roll-up'!$S$6"
ActiveChart.SeriesCollection(1).XValues = "='Roll-up'!$B$43:$B$54"
ActiveWindow.LargeScroll ToRight:=-1
ActiveWindow.SmallScroll Down:=-12