Creating multiple line graphs with macros problem

  • When i have multiple columns of data in excel the graphing with macros does not work properly. When I record macros it works when I select two columns together. If I choose one column, then press Ctrl and choose the second column individually the macro does not work. You can see the simple codes below. The first macro works no problem. I get an error with the second graph.

    Of course this is a problem, because i have data columns at different places and I want to put them in the same graph. The nature of my work demands making this graphs with macros.

    It's really strange and I don't understand because this is done while recording macros. It works when I record the macro, but when I run it, it does not.

  • Re: Creating multiple line graphs with macros problem


    Hi,


    try something like this



    HTH

  • Re: Creating multiple line graphs with macros problem


    Thanks, it works!

    But i get another problem when I try to modify it.

    What I want to do is that the user would type in the start and the end row at which the graph starts and ends. If you look at the code below the user types the start row in the cell Setup!B2 and end row in cell Setup!B3. The macro would then make many graphs from the Data! worksheet automatically. I tried putting this in the code krishnakumar wrote, but it doesn't work. :(

  • Re: Creating multiple line graphs with macros problem


    Hi P_Nut,
    Nice to meet you.
    Would you test this line?

    Code
    Set rngSource = Union(Range(Range(start1), Range(end1)), Range(Range(start2), Range(end2)))


    Regards, junho

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!