+ Reply to Thread
Results 1 to 9 of 9

Update chart souce data - excel file was uploaded

  1. #1
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Update chart souce data - excel file was uploaded

    Hello,

    I have a sheet with data and a chart which displays data as graph.

    Example:
    titles rows: a b c d
    data row1: 1 2 3 4
    data row2: 3 2 3 4

    Chart data source looks like: =Charts!$A$1:$B$5

    My problem: according to user selections, number of rows changes (there are more rows or less rows).

    I wish to change charts source data by VBA (Example: change to =Charts!$A$1:$B$10).

    I wrote a code to update chart source data but it does not work (I get error 438).

    Please Login or Register  to view this content.
    Can you help me ?

    Thank you
    Attached Files Attached Files
    Last edited by Snoopy2003; 09-30-2010 at 09:26 PM.

  2. #2
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Update chart souce data

    Hi

    To assist you it would help a great deal if you could upload an example workbook with dummy data, so it is possible to see exactly what you have.

    Regards

    Jeff

  3. #3
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Re: Update chart souce data

    Hello,

    Thank you for your answers. I added [code] tags and upload file example.
    In the sheet chart displays the data of the 2 rows.
    I wish to update chart data source using vba to display 3 rows data.

    Thank you

  4. #4
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Update chart souce data - excel file was uploaded

    Hi

    How many rows are you likely to use in your real world application and will they be sequential or not.

    Regards

    Jeff

  5. #5
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Re: Update chart souce data - excel file was uploaded

    Hello,

    Thank you for your anser. The number of rows is not static.
    I defined a string varible which contains data source range
    but I do not know how to update chart's properties it using VBA.

    Thank you

  6. #6
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Update chart souce data - excel file was uploaded

    Hi

    Sorry your answer is a little delayed as I was out of the city yesterday and did not have my computer. I will finalize everything and post back later this morning.

    Regards

    Jeff

  7. #7
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Thumbs up Re: Update chart souce data - excel file was uploaded

    Hello,

    Thank you for your answer.
    I managed to solve it by using VBA.

    Please Login or Register  to view this content.
    Thank you for your help

  8. #8
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Update chart souce data - excel file was uploaded

    Hi

    Good on you I am glad that you worked it out.

    Sorry I was delayed answering I think that I was trying to do something a little more complicated than you required.

    Attached is an example where you can select the ranges using check boxes and click on a button to see the updated chart.

    Regards

    Jeff
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Re: Update chart souce data - excel file was uploaded

    Hello,

    Thank you for your help.
    Your solution is elegant & usefull and I think I'll use it.
    It is user friendly solution.

    Thank you
    Last edited by Snoopy2003; 10-01-2010 at 05:03 PM.

+ 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