+ Reply to Thread
Results 1 to 8 of 8

graphing a chart in VBA, showing series legends on the chart

  1. #1
    Valued Forum Contributor
    Join Date
    10-21-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    513

    graphing a chart in VBA, showing series legends on the chart

    Hi guys,

    I'm trying to generate a graph in VBA, but am having some difficulties getting the series legend on the graph.

    Can anybody help?

    Please Login or Register  to view this content.
    So I think that for loop is what I want shown on the x-axis on the graph, but months are not showing when run.

    Any ideas?
    Attached Files Attached Files
    Last edited by Lifeseeker; 02-09-2012 at 09:58 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-21-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    513

    Re: graphing a chart in VBA, showing series legends on the chart

    Is anybody able to assist me on this?

    I'm almost there...

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

    Re: graphing a chart in VBA, showing series legends on the chart

    The chart type xy-scatter only displays numeric values on the axes.
    If you want months on the x axis you will need to use a Line chart.

    Please Login or Register  to view this content.
    If you want to have the months in the legend you will need to plot each value as a series rather than a data point in a single series.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Valued Forum Contributor
    Join Date
    10-21-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    513

    Re: graphing a chart in VBA, showing series legends on the chart

    thanks and it worked.

    It does take me some time to read through lines of code to understand

    Please Login or Register  to view this content.
    what does this code block do? If I got rid of it, nothing was changed. Is it normal?

    Thanks

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

    Re: graphing a chart in VBA, showing series legends on the chart

    If the activecell is in a block of data the add chart will attempt to use that data in the chart. The loop removes any series added by this action.

  6. #6
    Valued Forum Contributor
    Join Date
    10-21-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    513

    Re: graphing a chart in VBA, showing series legends on the chart

    when you say the activecell is in a block of data, what do you mean by a block of data? You mean if those fiscal months are in all in one cell?

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

    Re: graphing a chart in VBA, showing series legends on the chart

    I mean if the activecell contains data then excel will try and use that cell and the adjacent cells to populate the chart. If the cell is empty the chart will be empty.

    Try it. Select an empty cell and press F11 to create a chart.
    Now select a cell that has data and press F11.

  8. #8
    Registered User
    Join Date
    03-05-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: graphing a chart in VBA, showing series legends on the chart

    how to draw graph i have no value
    can any one suggest approx. value and the graph like above

+ 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