VBA beginner : Mulitple Charts, Loop For

  • Hi everyone,

    Here is the problem :

    In one sheet (nammed "DATA") : the data set

    In another sheet (nammed "Graphs"; same excel file) : the charts I want to make

    My real data set is very huge, but in order to simplify the topic, I made a typical example of it : see the attached file "Data.JPG".

    You will also find the example of graphics I want to generate from this data set.in the attached image "graphs.JPG"

    So, as you can see, my goal is to produce :

    For each variety and compound, I want to represent in a chart : the values of the compound (in Y) according to the Stage (in X) and by treatment (series 1 and series 2).

    For each series, I represent the mean values (upper table in the image) with their respective standard deviations (lower table in the image).

    So I have to build a loop allowing me to create a graph for each compound and variety.

    I would also like to order the graphs as in my example.

    As you can understand, I have two factors that have to be set in the loop.

    The "Varieties" factor, which corresponds to differents lines.

    The "Compound" factor, which corresponds to differents columns.

    Please find in the following code, the lines I made in order to build the first chart (top left).

    I am used to programming loops under R.

    However, VBA language is completely unknown to me, so I have a lot of trouble to manage this issue on my own or to identify usefull topics that could help me.

    Also I would be very grateful for any help or discussion around this "devil loop", for which I did not find any solutions for several days.

    If my question is not specific enough or if you are missing information, please let me know.

    Best regards,


  • Hi and Welcome to the Forum :)

    Why don't you attach your sample file ...;)

    This would make things a lot easier ... for everybody ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

Participate now!

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