+ Reply to Thread
Results 1 to 1 of 1

Generate multiple bar charts for each row in data range

  1. #1
    Registered User
    Join Date
    10-21-2020
    Location
    london
    MS-Off Ver
    10
    Posts
    5

    Generate multiple bar charts for each row in data range

    Hi

    I've tried a few how-to-write-macro sites to try and automate a graph form data each data row without success.

    I'm after a macro to produce a column chart with trend line for each row company - example as per chart 1 in attachment

    x axis = month
    y axis = data
    title = Company name in cell A and PPM DATA 2020

    I have managed to find a macro to produce my column graphs ( though without trend line) - the only issue is all graphs are located into the same sheet, I 've tried to modify to change to insert to new sheet for every graph but can't get it to run without error,

    I've tried to add new location sheet to below parts of macro but doesn't work so I am doing something wrong but no idea how to fix if any one can help

    With ActiveSheet.Shapes.AddChart.Chart

    macro that I currently using,


    Sub Addcharts()
    Dim i As Integer 'rows
    Dim j As Integer 'colmns

    i = Cells(Rows.Count, 1).End(xlUp).Row

    For j = 2 To 13
    With ActiveSheet.Shapes.AddChart.Chart
    .ChartType = xlColumnClustered
    .SeriesCollection.NewSeries
    With .SeriesCollection(1)
    .Name = "=" & ActiveSheet.Name & "!" & _
    Cells(1, j).Address
    .XValues = "=" & ActiveSheet.Name & "!" & _
    Range(Cells(2, 1), Cells(i, 1)).Address
    .Values = "=" & ActiveSheet.Name & "!" & _
    Range(Cells(2, j), Cells(i, j)).Address
    End With
    End With
    Next j

    End Sub
    Attached Files Attached Files
    Last edited by Excelidiot01; 11-13-2020 at 08:03 AM.

+ 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: 2
    Last Post: 04-07-2020, 08:25 AM
  2. [SOLVED] Plot unique charts with same data range across multiple sheets.
    By julesjanker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2020, 04:55 AM
  3. Add data labels from range (text) to multiple (but not all) charts in a sheet
    By RHEDE in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-15-2017, 08:16 AM
  4. Multiple SourceData range for charts
    By biznez in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2017, 04:58 PM
  5. Multiple Pie Charts For Non-Fixed range
    By hecgroups in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-05-2013, 12:32 PM
  6. Generate multiple charts from cols B & C, conditional of duplicate data in col A
    By kbeaulieu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2012, 08:07 PM
  7. Replies: 2
    Last Post: 09-08-2008, 05:05 AM

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