+ Reply to Thread
Results 1 to 5 of 5

Chart Datalabels.Position

  1. #1
    Michael Singmin
    Guest

    Chart Datalabels.Position

    Hello group,

    I am using Excel 2003.

    For a chart with labels, I am using
    .datalabels.position = 2 : Outside, 3 : Inside, 4 : Bottom
    How do I implement these defined constants below (VBA Help) ?

    XlDataLabelPosition can be one of these XlDataLabelPosition constants.
    xlLabelPositionAbove
    xlLabelPositionBestFit
    xlLabelPositionCustom
    xlLabelPositionInsideEnd
    xlLabelPositionMixed
    xlLabelPositionRight
    xlLabelPositionBelow
    xlLabelPositionCenter
    xlLabelPositionInsideBase
    xlLabelPositionLeft
    xlLabelPositionOutsideEnd

    If I use .DataLabels.Position = xlLabelPositionBelow
    I get a run time error 1004
    Curiously,
    ? XlLabelPostion.Right
    -4152
    and
    ? XlLabelPostion.Left
    -4131

    Any insights

    Michael Singmin



  2. #2
    Andy Pope
    Guest

    Re: Chart Datalabels.Position

    Hi,

    It all depends on the chart type you are working with. For instance a
    column chart datalabels can only be positioned using the following.
    xlLabelPositionOutsideEnd
    xlLabelPositionInsideEnd
    xlLabelPositionCenter
    xlLabelPositionInsideBase
    xlLabelPositionCustom

    To manually see what position are available check the Label Position
    dropdown on the Alignment tab of the format dialog for datalabels.

    Cheers
    Andy


    Michael Singmin wrote:
    > Hello group,
    >
    > I am using Excel 2003.
    >
    > For a chart with labels, I am using
    > .datalabels.position = 2 : Outside, 3 : Inside, 4 : Bottom
    > How do I implement these defined constants below (VBA Help) ?
    >
    > XlDataLabelPosition can be one of these XlDataLabelPosition constants.
    > xlLabelPositionAbove
    > xlLabelPositionBestFit
    > xlLabelPositionCustom
    > xlLabelPositionInsideEnd
    > xlLabelPositionMixed
    > xlLabelPositionRight
    > xlLabelPositionBelow
    > xlLabelPositionCenter
    > xlLabelPositionInsideBase
    > xlLabelPositionLeft
    > xlLabelPositionOutsideEnd
    >
    > If I use .DataLabels.Position = xlLabelPositionBelow
    > I get a run time error 1004
    > Curiously,
    > ? XlLabelPostion.Right
    > -4152
    > and
    > ? XlLabelPostion.Left
    > -4131
    >
    > Any insights
    >
    > Michael Singmin
    >
    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  3. #3
    Michael Singmin
    Guest

    Re: Chart Datalabels.Position

    Hi Andy,

    I am using bar coloums.
    BTW, John Walkenbach's PUP6 Addin uses those same XlLabelPosition
    definitions and they work.

    Michael
    =====================================================
    Andy Pope <[email protected]> wrote:

    >Hi,
    >
    >It all depends on the chart type you are working with. For instance a
    >column chart datalabels can only be positioned using the following.
    >xlLabelPositionOutsideEnd
    >xlLabelPositionInsideEnd
    >xlLabelPositionCenter
    >xlLabelPositionInsideBase
    >xlLabelPositionCustom
    >
    >To manually see what position are available check the Label Position
    >dropdown on the Alignment tab of the format dialog for datalabels.
    >
    >Cheers
    >Andy
    >
    >
    >Michael Singmin wrote:
    >> Hello group,
    >>
    >> I am using Excel 2003.
    >>
    >> For a chart with labels, I am using
    >> .datalabels.position = 2 : Outside, 3 : Inside, 4 : Bottom
    >> How do I implement these defined constants below (VBA Help) ?
    >>
    >> XlDataLabelPosition can be one of these XlDataLabelPosition constants.
    >> xlLabelPositionAbove
    >> xlLabelPositionBestFit
    >> xlLabelPositionCustom
    >> xlLabelPositionInsideEnd
    >> xlLabelPositionMixed
    >> xlLabelPositionRight
    >> xlLabelPositionBelow
    >> xlLabelPositionCenter
    >> xlLabelPositionInsideBase
    >> xlLabelPositionLeft
    >> xlLabelPositionOutsideEnd
    >>
    >> If I use .DataLabels.Position = xlLabelPositionBelow
    >> I get a run time error 1004
    >> Curiously,
    >> ? XlLabelPostion.Right
    >> -4152
    >> and
    >> ? XlLabelPostion.Left
    >> -4131
    >>
    >> Any insights
    >>
    >> Michael Singmin
    >>
    >>



  4. #4
    Andy Pope
    Guest

    Re: Chart Datalabels.Position

    If you have a column chart then xlLabelPositionBelow is not a valid
    position. Try this code it should position the data labels InsideBase
    and then error on the Below line.

    Sub x()
    With ActiveChart.SeriesCollection(1)
    If .HasDataLabels Then
    .DataLabels.Position = xlLabelPositionInsideBase

    ' following line will error as Below is not valid
    .DataLabels.Position = xlLabelPositionBelow
    Else
    MsgBox "Data labels not yet applied", vbExclamation
    End If
    End With
    End Sub


    Michael Singmin wrote:
    > Hi Andy,
    >
    > I am using bar coloums.
    > BTW, John Walkenbach's PUP6 Addin uses those same XlLabelPosition
    > definitions and they work.
    >
    > Michael
    > =====================================================
    > Andy Pope <[email protected]> wrote:
    >
    >
    >>Hi,
    >>
    >>It all depends on the chart type you are working with. For instance a
    >>column chart datalabels can only be positioned using the following.
    >>xlLabelPositionOutsideEnd
    >>xlLabelPositionInsideEnd
    >>xlLabelPositionCenter
    >>xlLabelPositionInsideBase
    >>xlLabelPositionCustom
    >>
    >>To manually see what position are available check the Label Position
    >>dropdown on the Alignment tab of the format dialog for datalabels.
    >>
    >>Cheers
    >>Andy
    >>
    >>
    >>Michael Singmin wrote:
    >>
    >>>Hello group,
    >>>
    >>>I am using Excel 2003.
    >>>
    >>>For a chart with labels, I am using
    >>> .datalabels.position = 2 : Outside, 3 : Inside, 4 : Bottom
    >>>How do I implement these defined constants below (VBA Help) ?
    >>>
    >>>XlDataLabelPosition can be one of these XlDataLabelPosition constants.
    >>>xlLabelPositionAbove
    >>>xlLabelPositionBestFit
    >>>xlLabelPositionCustom
    >>>xlLabelPositionInsideEnd
    >>>xlLabelPositionMixed
    >>>xlLabelPositionRight
    >>>xlLabelPositionBelow
    >>>xlLabelPositionCenter
    >>>xlLabelPositionInsideBase
    >>>xlLabelPositionLeft
    >>>xlLabelPositionOutsideEnd
    >>>
    >>>If I use .DataLabels.Position = xlLabelPositionBelow
    >>>I get a run time error 1004
    >>>Curiously,
    >>>? XlLabelPostion.Right
    >>>-4152
    >>>and
    >>>? XlLabelPostion.Left
    >>>-4131
    >>>
    >>>Any insights
    >>>
    >>>Michael Singmin
    >>>
    >>>

    >
    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  5. #5
    Michael Singmin
    Guest

    Re: Chart Datalabels.Position

    Thank you Andy,

    Your code does indeed work.
    It gives me the structure to resolve my own problem.

    Much appreciated

    Michael
    ============================================

    Andy Pope <[email protected]> wrote:

    >If you have a column chart then xlLabelPositionBelow is not a valid
    >position. Try this code it should position the data labels InsideBase
    >and then error on the Below line.
    >
    >Sub x()
    > With ActiveChart.SeriesCollection(1)
    > If .HasDataLabels Then
    > .DataLabels.Position = xlLabelPositionInsideBase
    >
    >' following line will error as Below is not valid
    > .DataLabels.Position = xlLabelPositionBelow
    > Else
    > MsgBox "Data labels not yet applied", vbExclamation
    > End If
    > End With
    >End Sub
    >
    >
    >Michael Singmin wrote:
    >> Hi Andy,
    >>
    >> I am using bar coloums.
    >> BTW, John Walkenbach's PUP6 Addin uses those same XlLabelPosition
    >> definitions and they work.
    >>
    >> Michael
    >> =====================================================
    >> Andy Pope <[email protected]> wrote:
    >>
    >>
    >>>Hi,
    >>>
    >>>It all depends on the chart type you are working with. For instance a
    >>>column chart datalabels can only be positioned using the following.
    >>>xlLabelPositionOutsideEnd
    >>>xlLabelPositionInsideEnd
    >>>xlLabelPositionCenter
    >>>xlLabelPositionInsideBase
    >>>xlLabelPositionCustom
    >>>
    >>>To manually see what position are available check the Label Position
    >>>dropdown on the Alignment tab of the format dialog for datalabels.
    >>>
    >>>Cheers
    >>>Andy
    >>>
    >>>
    >>>Michael Singmin wrote:
    >>>
    >>>>Hello group,
    >>>>
    >>>>I am using Excel 2003.
    >>>>
    >>>>For a chart with labels, I am using
    >>>> .datalabels.position = 2 : Outside, 3 : Inside, 4 : Bottom
    >>>>How do I implement these defined constants below (VBA Help) ?
    >>>>
    >>>>XlDataLabelPosition can be one of these XlDataLabelPosition constants.
    >>>>xlLabelPositionAbove
    >>>>xlLabelPositionBestFit
    >>>>xlLabelPositionCustom
    >>>>xlLabelPositionInsideEnd
    >>>>xlLabelPositionMixed
    >>>>xlLabelPositionRight
    >>>>xlLabelPositionBelow
    >>>>xlLabelPositionCenter
    >>>>xlLabelPositionInsideBase
    >>>>xlLabelPositionLeft
    >>>>xlLabelPositionOutsideEnd
    >>>>
    >>>>If I use .DataLabels.Position = xlLabelPositionBelow
    >>>>I get a run time error 1004
    >>>>Curiously,
    >>>>? XlLabelPostion.Right
    >>>>-4152
    >>>>and
    >>>>? XlLabelPostion.Left
    >>>>-4131
    >>>>
    >>>>Any insights
    >>>>
    >>>>Michael Singmin
    >>>>
    >>>>

    >>
    >>



+ 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