+ Reply to Thread
Results 1 to 25 of 25

Automatic chart creation with the range of 4 columns

  1. #1
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Automatic chart creation with the range of 4 columns

    Hello and good morning,

    I need to create 69 charts with 4 different series in every chart displaying information like average stock growth and so on. Is there any smarter way i can do that than manually when i know that the range of these charts will be consistant?

    Thanks in advance,
    Joachim

  2. #2
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    None have any sweet macro or something to solve this problem?

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    Do you really need all the charts? Can you not use 1 chart and alter the data displayed?

    You really need to post example file so we can see your data layout and chart formatting, otherwise any generic code will no doubt result in a response of "It does not work for my data" or "How do I change it for my data".
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Yes you're right, sorry. In this example, sheet 2 has the input data that=1 graph, the format of the graph you can find on sheet 1.
    And to answer your question, I need separate charts as they are going to be used in Word documents that goes out to clients.
    Attached Files Attached Files
    Last edited by Joachimjr; 06-30-2014 at 08:56 AM.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    Please Login or Register  to view this content.
    This will create a chart with data.
    You can use the macro recorder to get formatting and trendline additions.

  6. #6
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Very nice thank you! Will this macro create multiple charts from the range that I start it? And also, can it create the little graph that uses the last column data?

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    You would need to extend the macro to do more than 1 chart. But your workbook example did not include any indication of where things should be extended, Actually the example file did not even use the data in the workbook as it was all linked back to your original files.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    This creates single series chart under 1st. Then repeats using columns F:H and I keeping catergory based on column A

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Oh, Sorry for that. I will change it and I will also change the smaller graph.Example of Charts.xlsx

  10. #10
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Very nice! Thank you very much! So now if I want to start making graphs from GX7 for example, I just change "A7" to "GX7"? And also, is a macro recording best for automatically change the data series names?

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    The macro recording is best for getting the syntax. You will need to change it in order to incorporate in loop.

    If you had included the series names on the worksheet and chart I would have included in code.

  12. #12
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    The data series name is included in the "code" row of the sheet that is generated from datastream. Is there anyway that one can implement that in the code?

  13. #13
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Instead of having code as a name of every series, could one change something in the Code to name the series "Index", "50d moving average" and "200d moving average" so it will also be a fixed name for every chart created?

  15. #15
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Thanks for everything Andy! You helped me saving loads of time and minimizing the window for error in manually choosing range for every individual graph!

  17. #17
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Please Login or Register  to view this content.


    When I apply this code to my worksheet, I the the Compile error: Can't find project or library, why is that?

  18. #18
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    Is Datastream the code name of a worksheet?
    Did you really mean to add chart objects to chart sheets?
    Whats Daily?

    Check references in VBE for missing references.

  19. #19
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    Yes I solved the compile error, Datastream was not the correct code name, it was Sheet4. And for "CHARTS (Daily)" it was sheet1. But now when I use the macro, the charts come out incorrect. Have I changed something in the code that shouldn't be changed?

  20. #20
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    Charts is the collection for chart sheets.

    Would have saved a whole bunch of time and mucking about if you had posted usable example in the first place.

  21. #21
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    I'm sorry my friend I'm not that good at VBA and therefore not particularly good at posting a solid example.
    Here is how the code looks right now

    Please Login or Register  to view this content.

  22. #22
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    You don't need any VBA knowledge to post a workbook.

  23. #23
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    I'm sorry but I thought I posted that which was needed to create a code. And I'm also not allowed to post most of the things that I work with. Therefore I like to keep the things going out from the computer to a minimum.

  24. #24
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Automatic chart creation with the range of 4 columns

    But your example file is not like the one you are actually working with.
    For a start the code names of sheets does not tally and that is one of the things causing you problems.


    Sorry, but I'm stepping out of this thread now.

  25. #25
    Registered User
    Join Date
    06-27-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    72

    Re: Automatic chart creation with the range of 4 columns

    I thought that it would be easy fixable by just chaging the name of the sheets sorry my friend, thanks for everything.

+ 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. Automatic chart generation from 200 columns
    By boyboy400 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 11-06-2013, 05:51 PM
  2. [SOLVED] Automatic graph creation - rows and columns irregularity
    By marky9074 in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 12-19-2012, 10:01 AM
  3. VBA Chart Creation using Variable Range
    By Miraun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2011, 01:37 PM
  4. Replies: 14
    Last Post: 12-03-2009, 06:36 PM
  5. [SOLVED] Use of Range(Cell1,Cell2) in chart creation
    By jeh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2006, 06:45 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