+ Reply to Thread
Results 1 to 11 of 11

Adding additional source data to a chart

  1. #1
    Registered User
    Join Date
    10-18-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Adding additional source data to a chart

    This is the first time I'm using Macros in Excel and I'm having trouble trying to add additional source data to a chart. I created a macro using the record macro tool; however it only generates a new series on the chart. The Name, X Value and Y Value fields are completely empty. How do I change the macro to populate them?

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Adding additional source data to a chart

    Try

    Please Login or Register  to view this content.
    and then set the values in a similar way to those in the code that you recorded.
    Martin

  3. #3
    Registered User
    Join Date
    10-18-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Adding additional source data to a chart

    Thanks. I tried that and it still creates a new series without data. A run-time error occurs, when going into the debug option the second line in code is highlighted. I'm very new to all this and really appreciate you helping me out :-)

    Code:
    sub snb()
    ActiveChart.SeriesCollection(5).XValues = "=BER!R26C2:R33C2
    end sub

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Adding additional source data to a chart

    Try this.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-18-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Adding additional source data to a chart

    That also still doesnt work :-( this time the debugger higlights the .values line. I'm starting to think it might be easier to keep adding measurements manualy :-(

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

    Re: Adding additional source data to a chart

    It would probably help to post example file explain further what the code should do.
    Cheers
    Andy
    www.andypope.info

  7. #7
    Registered User
    Join Date
    10-18-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Adding additional source data to a chart

    I've (hopefully) attatched a simpler version of what I'm attempting to do.

    Basically I have three sets of results for one mission. In order to easily compare new missions to older ones I want to plot the data onto a graph. However I currently have over 20 old missions with new ones coming every six months or so. And as I'm not the only person who will be using this document in the future I wanted to automate all the graphing functions. So in the future they will simply copy the data input tabel then implement a macro for it to add the data to the chart.

    I thought I'd try to get a simple macro to just plot data before I attempted to work out how to make it shift down the sheet as new data sets are added.

    Thanks for trying to help me solve this problem :-)

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

    Re: Adding additional source data to a chart

    No attachment. Is it too big?

  9. #9
    Registered User
    Join Date
    10-18-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Adding additional source data to a chart

    I dont think so I completly striped it down its only 36.5KB. It says its attatched in the Attatch files section.
    Attached Files Attached Files

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

    Re: Adding additional source data to a chart

    This will prompt the use for a test name.
    It will use series 4 to 6, creating series if required.

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    10-18-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Adding additional source data to a chart

    Thank you so much its perfect! :-D

+ 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