ReversePlotOrder throws Label to opposite side

wasabi

New Member
Joined
Apr 12, 2010
Messages
28
I'm creating a macro that creates a graph. However, the Y-value of one of the lines is always negative but approaching zero and the other is always positive and increasing, so I used ReversePlotOrder = True for the former. That way the graphs are easy to distinguish: one goes up, the other goes down.

However, I've hit a bump. ReversePlotOrder = True throws the Title of the X axis to the top of the graph.

Here's the code:
Code:
Sub Graph()
'Application.ScreenUpdating = True
Application.ScreenUpdating = False
With ActiveWorkbook.Worksheets(2)
    ActiveWorkbook.Worksheets(2).Activate
    Range("X2").End(xlDown).Activate
    Set LstCl = ActiveCell
    'SIGYxPORO
    Set Rng1 = Range("X2", LstCl)
    Set Rng2 = Range("AA2", Cells(LstCl.Row, LstCl.Column + 3))
    Set Rng3 = Range("Z2", Cells(LstCl.Row, LstCl.Column + 2))
    Set Rng4 = Range("AC2", Cells(LstCl.Row, LstCl.Column + 5))
    Set Rng = Union(Rng1, Rng2, Rng3, Rng4)
    Sname = Range("A1").Parent.Name
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Rng, PlotBy:=xlColumns
    ActiveChart.Location Where:=xlLocationAsObject, Name:=Sname
    ActiveChart.HasTitle = False
    With ActiveChart
        .Axes(xlCategory, xlPrimary).HasTitle = True
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "STEP"
        .Axes(xlValue, xlPrimary).HasTitle = True
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "SIGY"
        .Axes(xlValue).ReversePlotOrder = True
    End With
End With
Application.ScreenUpdating = True
End Sub
That's just a small part of the code, but it works.

So my question is, how can I move the X-axis Title back down?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
untitled.jpg

I just printscreened this to show the difference. The graph on the left has the x-axis' title on top. The one to the right has it on the bottom, alongside the actual x-axis values. They were both created by the same macro, the only difference being that, on the left ReversePlotOrder = True and, to the right, = False.

I've even step-by-stepped the macro and it's quite clear that the problem is ReversePlotOrder.

Oh, and no, STEP is not the title of the graph on the left, obviously.
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,458
Members
449,085
Latest member
ExcelError

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