I have a code that changes the range of data for a chart as more values are entered. I want the user to enter their values and the chart to automatically update but am unsure how to do this. The code works fine when i manually run it, so the only challenge is making it run by itself. Any help would be appreciated.
The chart i am having difficulty with is the time spent versus time allocated chart.
The chart i am having difficulty with is the time spent versus time allocated chart.
VBA Code:
Private Sub TimeSpent()
Dim ch As ChartObject
Set ch = Worksheets("Executive Summary").ChartObjects("Chart 8")
LastRow = Worksheets("Executive Summary").Columns("J").Find(1, SearchDirection:=xlPrevious, LookIn:=xlValues, LookAt:=xlWhole).Row
Worksheets("Executive Summary").ChartObjects("Chart 8").Activate
ActiveChart.FullSeriesCollection(1).Name = Worksheets("Executive Summary").Range("L34")
ActiveChart.FullSeriesCollection(1).Values = Range(Cells(35, 12), Cells(LastRow, 12))
' ActiveChart.FullSeriesCollection(1).GapWidth = 60
ActiveChart.FullSeriesCollection(2).Name = Worksheets("Executive Summary").Range("M34")
ActiveChart.FullSeriesCollection(2).Values = Range(Cells(35, 13), Cells(LastRow, 13))
ActiveChart.HasLegend = True
End Sub