I have the following code that creates a chart based on a table from Range("Y2:Z" & iRow3), where iRow3 is the last row of the table (changes as new data is input):
With ActiveSheet.ChartObjects.Add(Left:=Range("C12").Left, _
Top:=Range("C12").Top, _
Width:=Range("C12:G24").Width, _
Height:=Range("C12:G24").Height).Chart
.ChartType = xlXYScatterLines
.SetSourceData Source:=Union(Sheets("FT1 Data").Range("Y2:Y" & iRow3), Sheets("FT1 Data").Range("Z2:Z" & iRow3)), _
PlotBy:=xlColumns
.HasLegend = False
.HasTitle = True
.ChartTitle.Select
.ChartTitle.Text = "Transformation Progress"
End With
The Y Column is the Period, which I would like on the x-axis. The Z Column is the Progress or score that I'm tracking over time, which I would like on the y-axis. With the current code I have, the x-axis increments are just enumerating 1,2,3, etc. instead of the values I have in the Period (Y) column. As for my y-axis, the range is dependent on the range of my data in the Z column; how do I go about changing it so that the range is fixed, for example between 0 and 5?
All input is much appreciated! Thanks in advance!
With ActiveSheet.ChartObjects.Add(Left:=Range("C12").Left, _
Top:=Range("C12").Top, _
Width:=Range("C12:G24").Width, _
Height:=Range("C12:G24").Height).Chart
.ChartType = xlXYScatterLines
.SetSourceData Source:=Union(Sheets("FT1 Data").Range("Y2:Y" & iRow3), Sheets("FT1 Data").Range("Z2:Z" & iRow3)), _
PlotBy:=xlColumns
.HasLegend = False
.HasTitle = True
.ChartTitle.Select
.ChartTitle.Text = "Transformation Progress"
End With
The Y Column is the Period, which I would like on the x-axis. The Z Column is the Progress or score that I'm tracking over time, which I would like on the y-axis. With the current code I have, the x-axis increments are just enumerating 1,2,3, etc. instead of the values I have in the Period (Y) column. As for my y-axis, the range is dependent on the range of my data in the Z column; how do I go about changing it so that the range is fixed, for example between 0 and 5?
All input is much appreciated! Thanks in advance!