Insert Graphs based on multiple unknown size sets of data?
Results 1 to 2 of 2

Thread: Insert Graphs based on multiple unknown size sets of data?
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2019
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default Insert Graphs based on multiple unknown size sets of data?

    I have a tool that creates a csv file with multiple tables of data. These tables are seperated by a blank line of cells. I want to be able to copy this data, and paste it into an excel sheet, and have the sheet auto generate a line graph for each table of data. Is there a way to do this?
    Example of data that would be pasted (there would be a known number of tables, but unknown size of each):
    This example has two tables that I have circled

  2. #2
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Post Thanks / Like
    64 Post(s)
    14 Thread(s)

    Default Re: Insert Graphs based on multiple unknown size sets of data?

    Try this

    Sub Insert_Graphs()
      Dim bl As Range
      For Each bl In Range("A1", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Areas
        Sheets.Add after:=Sheets(Sheets.Count)
        ActiveChart.SetSourceData Source:=Range("$A$1:$E$" & Range("A" & Rows.Count).End(xlUp).Row)
        ActiveChart.ChartType = xlLineStacked
    End Sub
    If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (Insert_Graphs) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "Yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
    Regards Dante Amor

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts