+ Reply to Thread
Results 1 to 6 of 6

Charts with variable data source

  1. #1
    Forum Contributor
    Join Date
    11-18-2008
    Location
    uk
    MS-Off Ver
    Excel 2003 and Excel 2010(sometimes)
    Posts
    139

    Charts with variable data source

    Good Morning All

    Firstly I would like to apologise for my lack of knowledge on Excel Charts

    The problem I have is that the data range varies each time and this is based on the value of a variable in the VBA

    Example

    The data range could be

    a15:a & max_line

    where max_line = 41

    so the data range

    a15:a41

    the problem is the value of max_line is always known but changes


    Please help by pointing me in the right direction

    Many Thanks in advance

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: Charts with variable data source

    Suggest you post a sample workbook with whatever code you have ... and some typical data. Ideally, mock up what you hope/expect to get out.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    11-18-2008
    Location
    uk
    MS-Off Ver
    Excel 2003 and Excel 2010(sometimes)
    Posts
    139

    Re: Charts with variable data source

    Thanks Trevor i have attached a sample workbook

    I will try and explain what I need

    For the example in attached workbook

    The value in RawData!D1 is 10 (this is changed by the user each time)

    Chart X Axis is A15:A66
    Chart Y Axis is C15:C66

    but what I need is a15:a & max_line
    c15:c & max_line

    where max_line is a public variable in the VBA code

    I hope this helps

    PS
    Password for VBA = 2729
    Password for sheets = 1111

    Thanks in advance
    Attached Files Attached Files

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: Charts with variable data source

    OK, please have a look at the updated example. I have included an explanation of the approach that I have taken.

    I haven't changed your code. However, it should be a simple case of setting the range on the Raw Data sheet to the value of the Public variable max_line

    As an example:

    Please Login or Register  to view this content.

    Regards, TMS
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-18-2008
    Location
    uk
    MS-Off Ver
    Excel 2003 and Excel 2010(sometimes)
    Posts
    139

    Re: Charts with variable data source

    Sorry Trevor I can see where you explained your approach in the attached file
    Think I must be having a blond moment sorry?

  6. #6
    Forum Contributor
    Join Date
    11-18-2008
    Location
    uk
    MS-Off Ver
    Excel 2003 and Excel 2010(sometimes)
    Posts
    139

    Re: Charts with variable data source

    sorry wasnt opening the the correct file sorry
    reading through it now

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel 2007 : Source Data in Charts
    By Janie in forum Excel General
    Replies: 1
    Last Post: 08-26-2009, 12:02 PM
  2. Charts and source data
    By jenster in forum Excel General
    Replies: 0
    Last Post: 08-31-2007, 08:58 AM
  3. [SOLVED] Using Arrays as source data for charts
    By MJH2369 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2006, 10:40 AM
  4. extending source data in several charts
    By Mike in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 11-29-2005, 01:40 AM
  5. Replies: 3
    Last Post: 10-13-2005, 09:05 PM

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