+ Reply to Thread
Results 1 to 4 of 4

dynamic chart with VBA code

  1. #1
    Registered User
    Join Date
    09-12-2007
    Posts
    3

    dynamic chart with VBA code

    Can anyone tell me how to use VBA code for the dynamic chart? I have 30 charts need to be plotted as dynamic chart. I know how to do it manually but it is very time consuming. However, there is always an error message for defining the name range.
    Thanks!
    Wei

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481
    Hi there,

    It's possible to manipulate charts using VBA, but I've always found it to be both complicated and inflexible.

    My preferred alternative when charting data sets which have the same structure is to use a single chart populated from a single range. This single range is then populated from the various data sets by using functions such as INDIRECT and LOOKUP. This allows you to achieve what you want within Excel itself.

    Hope this suggestion helps - let me know if you need anything further.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    09-12-2007
    Posts
    3

    sample codes?

    Greg M,
    Thanks for your answer, I am quite new to Excel VBA, can you post some sample codes or briefly mention the process to use INDIRECT and LOOKUP?
    I really appreciate it.
    Wei
    Last edited by weii; 09-13-2007 at 11:55 AM.

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481
    Hi again Wei,

    The attached workbook shows a very simple example of what I'm talking about.

    The chart always takes its data from the same (highlighted) range, but the VALUES in the highlighted range are appropriate to whichever year is selected from the dropdown list at the start of the highlighted range. This is achieved by using the VLOOKUP function.

    Hope this helps - please let me know how you get on.

    Best regards,

    Greg M
    Attached Files Attached Files

+ 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