Setting X-Axis Values & Y-Axis Range

aesta

New Member
Joined
Aug 15, 2017
Messages
6
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!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top