Can I make a custom x-axis??

South_Florida

New Member
Joined
Jun 1, 2016
Messages
9
I need my x axis to range from 100-2500 but I want it to appear as intervals as 500 with the initial starting value of 100 not being shown. The axis should read 500,1000,1500,2000,2500. Can this be done and how?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
Hi

Remark: When you post about a chart it's important to say what is the chart type
This solution will work for some chart types.


You have to make your own X-axis.

Steps:
1 - Set the minimum value for the default X-axis to 100 and hide it. To hide the axis, in the Format Axis set "Major tick mark type", "Minor tick mark type" and "Axis labels" all to "None"
2 - Add the line that will be your axis: Add a scatter series with points where you want the labels. All with Y=0. In your case the points (100,0), (500,0), (1000,0)
3 - Add labels to the points
 
Last edited:

South_Florida

New Member
Joined
Jun 1, 2016
Messages
9
Sorry, I'm using an XY scatter plot.

I've done step one but I'm stuck on two. I've added points (500,0), (1000,0)..etc but how will they appear on my chart? How do I add labels to them?
 

South_Florida

New Member
Joined
Jun 1, 2016
Messages
9
Okay disregard that last post I figured it out. However, I'm recording a macro and my code for the second series (the one used for (500,0), (1000,0)..etc) gives me trouble when I open a new .txt file as the macro copied the name of the file I used to record the macro with as shown below

ActiveChart.SeriesCollection(2).XValues = "='Pure Ethanol 12May16'!$O$1:$O$5"
ActiveChart.SeriesCollection(2).Values = "='Pure Ethanol 12May16'!$P$1:$P$5"

I just tried simplifying it down to

ActiveChart.SeriesCollection(2).XValues = "=!$O$1:$O$5"'

but that did not help. Do you have a suggestion here?
 

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
I just tried simplifying it down to

ActiveChart.SeriesCollection(2).XValues = "=!$O$1:$O$5"'

but that did not help. Do you have a suggestion here?

Hi

If you mean that you want to assign the XValues a range in the active sheet, you can use:

Code:
        ActiveChart.SeriesCollection(2).XValues = ActiveSheet.Range("$O$1:$O$5")
 
Last edited:

Forum statistics

Threads
1,182,140
Messages
5,933,866
Members
436,915
Latest member
Cygne volant

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
Top