+ Reply to Thread
Results 1 to 10 of 10

VBA Chart - defining Legend placement and size

  1. #1
    Registered User
    Join Date
    04-22-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    94

    VBA Chart - defining Legend placement and size

    I need some help with a chart i am creating using vba code, i want to define the placement and size of the legend but im having difficulty do this, can anyone help
    Last edited by PRodgers4284; 11-07-2009 at 10:09 AM.

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

    Re: VBA Chart - defining Legend placement and size

    What exactly is the problem? Error running code maybe or just not the desired result.

    Post example workbook and explain further your problem.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-22-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    94

    Re: VBA Chart - defining Legend placement and size

    Quote Originally Posted by Andy Pope View Post
    What exactly is the problem? Error running code maybe or just not the desired result.

    Post example workbook and explain further your problem.

    Andy there are no errors, the legend appears but i want to define where it is displayed on the chart, the size/font etc, i am not sure of the syntax to do this.

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

    Re: VBA Chart - defining Legend placement and size

    Have you tried the macro recorder?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-22-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    94

    Re: VBA Chart - defining Legend placement and size

    Andy i have used your code and it works but i want the legend on the top right of the plot area, when i try to do this the plot area move to the bottom of the chart area, how do i put the legend on the plot area? My code is:

    Please Login or Register  to view this content.

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

    Re: VBA Chart - defining Legend placement and size

    More like

    Please Login or Register  to view this content.
    Top right outside of plotarea.

  7. #7
    Registered User
    Join Date
    04-22-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    94

    Re: VBA Chart - defining Legend placement and size

    Quote Originally Posted by Andy Pope View Post
    More like

    Please Login or Register  to view this content.
    Top right outside of plotarea.

    Andy how do i put the legend on the inside of the plot area at the top right?

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

    Re: VBA Chart - defining Legend placement and size

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-08-2009
    Location
    Austin, TX
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: VBA Chart - defining Legend placement and size

    Unless I'm misreading some of the code you posted Andy, you're mostly controlling the placement of the legend (top, bottom, etc.).

    What I need to do is have the height and width of my legen change based on the number of series and the length of the series names. Picking that information up isn't my problem (the LEN formula isn't exactly a mystery and I already make use of some code to pick up the series count).

    What I'm not sure of is how to translate that into values for height and length. Once I have that I've already used the recorder to get the code to change height and width

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

    Re: VBA Chart - defining Legend placement and size

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

    Start a new thread and include a workbook example that illustrates the problem you are trying to resolve.

+ 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