+ Reply to Thread
Results 1 to 3 of 3

Secundary Axis

  1. #1
    ignhdez
    Guest

    Secundary Axis


    Hi All,

    This is a "Charting through VBA" question.


    Is there any way to specify features for the secundary axis different
    for those of the Y axis (Xlvalue ).


    I´ve tried this but it didn´t work.

    For the main Y axis

    With ActiveChart.Axes(xlValue)

    .HasTitle = True
    .HasMinorGridlines = False
    .HasMajorGridlines = False
    .AxisTitle.Orientation = xlHorizontal
    .AxisTitle.Text = "M€"
    .TickLabels.Orientation = xlHorizontal
    .TickLabels.Font.Size = 8

    End With

    For the Secondary axis

    With ActiveChart.Axes(xlSecondary)

    .HasTitle = True
    .AxisTitle.Orientation = xlHorizontal
    .AxisTitle.Text = "hh€"
    .TickLabels.Orientation = xlHorizontal
    .TickLabels.Font.Size = 8

    End With


    I,ve even tried

    With ActiveChart.Axes.Item(2)

    No way


    Could anybody give me a clue over how to achieve it ?

    Thanks


    --
    ignhdez
    Posted from - http://www.officehelp.in


  2. #2
    Peter T
    Guest

    Re: Secundary Axis

    I assume the missing dot's to attach to the "With" is an omission in the
    post. But the main thing is if you want to refer to the secondary axis you
    need to supply the second optional argument to "Axes", from help -

    expression.Axes(Type, AxisGroup)

    With ActiveChart.Axes(xlValue, xlSecondary)
    .HasTitle = True
    If .AxisGroup = xlPrimary Then
    .HasMinorGridlines = False
    .HasMajorGridlines = False
    End If
    .AxisTitle.Orientation = xlHorizontal
    .AxisTitle.Text = "M€"
    .TickLabels.Orientation = xlHorizontal
    .TickLabels.Font.Size = 8
    End With

    Also note

    > With ActiveChart.Axes(xlSecondary)


    is the same as doing

    With ActiveChart.Axes(xlValue, xlPrimary)

    because xlSecondary & xlValue both return the constant value 2, and
    xlPrimary is the default optional second argument.

    Regards,
    Peter T


    "ignhdez" <ignhdez.2450x3@NoSpamPleaze.com> wrote in message
    news:ignhdez.2450x3@NoSpamPleaze.com...
    >
    > Hi All,
    >
    > This is a "Charting through VBA" question.
    >
    >
    > Is there any way to specify features for the secundary axis different
    > for those of the Y axis (Xlvalue ).
    >
    >
    > I´ve tried this but it didn´t work.
    >
    > For the main Y axis
    >
    > With ActiveChart.Axes(xlValue)
    >
    > HasTitle = True
    > HasMinorGridlines = False
    > HasMajorGridlines = False
    > AxisTitle.Orientation = xlHorizontal
    > AxisTitle.Text = "M€"
    > TickLabels.Orientation = xlHorizontal
    > TickLabels.Font.Size = 8
    >
    > End With
    >
    > For the Secondary axis
    >
    > With ActiveChart.Axes(xlSecondary)
    >
    > HasTitle = True
    > AxisTitle.Orientation = xlHorizontal
    > AxisTitle.Text = "hh€"
    > TickLabels.Orientation = xlHorizontal
    > TickLabels.Font.Size = 8
    >
    > End With
    >
    >
    > I,ve even tried
    >
    > With ActiveChart.Axes.Item(2)
    >
    > No way
    >
    >
    > Could anybody give me a clue over how to achieve it ?
    >
    > Thanks
    >
    >
    > --
    > ignhdez
    > Posted from - http://www.officehelp.in
    >




  3. #3
    ignhdez
    Guest

    Re: Secundary Axis


    Thank you Peter T

    Now it works nicely


    --
    ignhdez
    Posted from - http://www.officehelp.in


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1