+ Reply to Thread
Results 1 to 5 of 5

Chart source data - VBA

  1. #1
    Forum Contributor
    Join Date
    10-11-2008
    Location
    Portugal
    MS-Off Ver
    Excel 2010
    Posts
    111

    Chart source data - VBA

    Hi,

    How do I define a chart's source data in VBA? Is it possible? I can't seem to find the command to do so

    Thanks
    Last edited by Coaster; 05-08-2010 at 04:58 PM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Chart source data - VBA

    Coaster,

    start the macro recorder, select some data, create a chart. Select a chart series, change the data source. Stop the macro recorder. Study the code.

    This is for Excel 2003. If you use 2007 that won't work.

    Please update your profile and indicate your Excel version to take the guesswork out of the answering.

  3. #3
    Forum Contributor
    Join Date
    10-11-2008
    Location
    Portugal
    MS-Off Ver
    Excel 2010
    Posts
    111

    Re: Chart source data - VBA

    I'm sorry I didn't remember that "little" detail lol

    Excel 2007...I tried doing that but didn't get anywhere, as you said...what should I do?

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Chart source data - VBA

    Coaster, unfortunately the Excel 2007 macro recorder ignores a lot of things to do with charting. It gets better again with Excel 2010.

    I recorded the code below with 2010
    - selected a range, first column has dates, third and second column has numbers
    - created a chart (clustered column chart)
    - edited each series and...
    - defined new data ranges and data series title for two series
    - defined new range for X axis (categories)
    Hope you can glean something from that.

    Please Login or Register  to view this content.
    cheers

  5. #5
    Forum Contributor
    Join Date
    10-11-2008
    Location
    Portugal
    MS-Off Ver
    Excel 2010
    Posts
    111

    Re: Chart source data - VBA

    Thank you very much, that's just what i needed!

+ 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