Plot Multiple series in one graph using vba


  • Hi guy..
    In case you all haven't seen my previous thread about the same topic, i am posting this thread again as i need this code quite urgent. Thanks..

    I did a userform that allow user to choose, using option button, which graph user wants to plot and it will run a macro that plot that sepecific graph. If i want to improve it so that it can allow the user to choose more than one selections and the macro will plot multiple lines in just one chart. For example, normally we just plot one y-value vs one x-value; now i want the macro to plot more than one y-values vs one x-value by randomly choose any options the user likes.
    I have thought of a stupid way which is record lots of macros that satisfy all combinations of choices. There must be a better way, isn't it?

    Friday, August 18, 2006 2:00 AM

All replies

  • Hi Pippen

    Check each of your controls and that at least one is checked , if more than one checked you can use the add method to attach the extra lines to your graph. Below is pasted from the Excel Help text


    This example creates a new series in Chart1. The data source for the new series is range B1:B10 on Sheet1.

    Charts("Chart1").SeriesCollection.Add _

    This example creates a new series on the embedded chart on Sheet1.

    ActiveChart.SeriesCollection.Add _

    Friday, August 18, 2006 8:48 AM