+ Reply to Thread
Results 1 to 7 of 7

Help with Legend on X Axis

  1. #1
    Registered User
    Join Date
    02-24-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2003
    Posts
    7

    Help with Legend on X Axis

    [SOlVED]
    Hi

    I have a Excel Chart(s) that i create using vb.net and Excel. I am trying to get the legend to appear on the bottom of the page by the X Axis and I am using the property .SetElement(501) however i keep encountering a Com error .
    What am i doing wrong. Attached is and example of what my final product should look like after my vb.net code runs. Also attached is the error.

    my current Code:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by zwheeler; 05-21-2014 at 01:28 PM. Reason: had to add code tags

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Help with Legend on X Axis

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Help with Legend on X Axis

    In excel the macro recorder provides the following for setting legend to bottom

    Please Login or Register  to view this content.
    The constant msoElementLegendBottom is 104. So try that instead of 501.

    501 appears to add a Data table to the xaxis which is not valid on xy-scatter charts.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    02-24-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Help with Legend on X Axis

    hi

    i tried your suggestion but i still got the same error.

    thanks

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Help with Legend on X Axis

    Did you try changing the chart type to Line rather than xy-scatter?

  6. #6
    Registered User
    Join Date
    02-24-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Help with Legend on X Axis

    Good Morning

    Yes I did and i still get the same error.

  7. #7
    Registered User
    Join Date
    02-24-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Help with Legend on X Axis

    HI

    Thank you i got it to work.
    I had to place the .SetElement after the graph had been created.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Axis & Legend Labels Missing when viewing from Excel 2010
    By Luisao82 in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 02-10-2014, 04:49 AM
  2. [SOLVED] Line Graph - Legend Series on an Axis - League Table Tracker
    By JungleJme in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 09-14-2012, 11:00 AM
  3. Legend Only Shows Used Axis on Dynamic Chart (X, Y and Y2 axis)
    By TEBrown in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 06-21-2012, 10:15 AM
  4. [SOLVED] switch around info from legend to axis
    By Sallie in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-07-2006, 10:10 PM
  5. Labelling bar graph-the bars in X-axis not via tthe legend
    By MikeR-Oz in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-03-2006, 06:30 PM

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