+ Reply to Thread
Results 1 to 4 of 4

Insert Charts for every worksheet in workbook using VBA

  1. #1
    Registered User
    Join Date
    12-09-2019
    Location
    Guelph, Canada
    MS-Off Ver
    office 365
    Posts
    8

    Insert Charts for every worksheet in workbook using VBA

    Hello friends,

    I'm trying to create a line chart for every sheet in a workbook that contains over 100 sheets. The data is stored in a table. I've had some luck creating the charts but unfortunately a little bit of extra information is being added to charts. I only require columns "testdate", "inst1", "inst2" for charts, where "testdate" is the x-axis, and "inst1" and "inst2" are two line series on the same plot. The code is as follows:

    Please Login or Register  to view this content.
    The first sheet will show a sample of what I'm trying to achieve.
    Also if you could add a line of code to connect empty cells as data points as well, that'd be wonderful. Thank you!
    Attached Files Attached Files
    Last edited by unmasked_crusader; 05-16-2021 at 11:45 AM.

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

    Re: Insert Charts for every worksheet in workbook using VBA

    Hi there,

    Take a look at the attached version of your workbook and see if it does what you need. It uses the following code:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.


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

    Regards,

    Greg M
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-09-2019
    Location
    Guelph, Canada
    MS-Off Ver
    office 365
    Posts
    8

    Re: Insert Charts for every worksheet in workbook using VBA

    This works great! Thank you so much, you're a lifesaver!

    For whatever reason my excel defaults to reading NA's as gaps in charts so added this extra line
    Please Login or Register  to view this content.
    Have a great day!

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

    Re: Insert Charts for every worksheet in workbook using VBA

    Hi again,

    Many thanks for your very prompt feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ 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. Replies: 1
    Last Post: 02-26-2021, 04:29 PM
  2. Replies: 1
    Last Post: 08-28-2014, 05:23 PM
  3. [SOLVED] Code to insert Worksheet before a specific worksheet in a workbook
    By scass in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2012, 09:39 AM
  4. [SOLVED] How do I insert just one worksheet of a workbook into an email?
    By Sarah in forum Excel General
    Replies: 2
    Last Post: 12-19-2005, 04:25 PM
  5. Replies: 8
    Last Post: 07-04-2005, 05:05 PM
  6. Replies: 2
    Last Post: 07-04-2005, 12:05 PM
  7. MY WORKBOOK WON'T LET INSERT ANOTHER WORKSHEET.
    By jlf in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-30-2005, 03:06 PM

Tags for this Thread

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