How to make multiple charts in excel using vba

Поделиться
HTML-код
  • Опубликовано: 27 авг 2019
  • Using one table where the first column is the x values and every other column is the y values in their own charts.
    Sub AddCharts()
    Dim i As Integer 'rows
    Dim j As Integer 'columns
    i = Cells(Rows.Count, 1).End(xlUp).Row
    For j = 2 To 4
    With ActiveSheet.Shapes.AddChart.Chart
    .ChartType = xlXYScatter
    .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
    .HasLegend = False
    End With
    Next j
    End Sub
    Where I got the code from:
    www.mrexcel.com/forum/excel-q...
    Different chart types in excel vba: bettersolutions.com/excel/cha...
    ---------------------------------------------------------------------------------
    #exceltutorials #excelvba #excelcharts
    SUBSCRIBE: goo.gl/c46YPs
    Microsoft Office 365, 2016, Office Insider, Version 1909
    These data are related to my PhD research
    ---------------------------------------------------------------------------------
    IF YOU LIKED THIS VIDEO YOU MAY ALSO LIKE:
    - How to quickly make multiple charts in excel • How to quickly make mu...
    - How to make panel charts in excel - method 1 • How to make panel char...
    - How to make a dynamic chart using data validation • How to make a dynamic ...
  • НаукаНаука

Комментарии • 29

  • @karinaadcock
    @karinaadcock  4 года назад +1

    Hope you learnt something new and interesting. Thanks for watching and please Like, Comment and Subscribe.

  • @promiseceasar5003
    @promiseceasar5003 4 года назад +1

    I am so glad I found your video!!! Thank you for making it and posting! It’s so refreshing to see a video working with data that resembles mine, you saved me months of trial and error!

  • @JHatLpool
    @JHatLpool 3 года назад

    Great demonstration. Nice, clear description. Thanks !

  • @yem.t.3930
    @yem.t.3930 3 года назад

    Thank you sooo much Madam! Very clear, easily understandable, clear video and audio !
    would be happy for more tutorials !
    Cheers !

  • @esdrasjesustorresramirez5417
    @esdrasjesustorresramirez5417 2 года назад

    Thanks for your amazing work. This was a terrific example of Macros.

  • @PiroMat15
    @PiroMat15 3 года назад +1

    Right now, I have around 1000 charts to do, and I must say that I love You :)
    That's piece of code what I was looking for, exactly. Thank You so much.

  • @SGH-rt6ci
    @SGH-rt6ci 3 года назад

    Dear Ms Karina, clear brilliant explanation ! btw your pleasant voice makes this tutorial easy to graps

  • @nasroml12
    @nasroml12 4 года назад

    thx a lot, this is so useful

  • @sgdingman
    @sgdingman 4 года назад

    Thanks, this is very helpful.

  • @isaaccastillo8628
    @isaaccastillo8628 2 года назад

    Thank you so much Karina, Lord Jesus bless you!

  • @leoricardo5743
    @leoricardo5743 4 года назад

    This is the best. Now lets test in and see if it works (here as i have to make 100 similar graphs, each with the same date but 4 series.
    I was also trying named ranges. Can you add these in?

  • @zij5224
    @zij5224 4 года назад

    Thanks, very helpful! What if I have different X axis? Could you suggest?

  • @prathapg5866
    @prathapg5866 3 года назад

    Thank you for your video Karina, I have a couple of questions like is it the same for pie charts too (xlpie) and how to navigate to the respective field after selecting a slice of a pie chart
    it would be really helpful for me.
    Thank you

  • @hopewu7173
    @hopewu7173 3 года назад

    May I please know how to add trendline with equation in VBA as well? thanks a lot

  • @bhavanth1
    @bhavanth1 Год назад

    Hy Thanks for the video.
    Can you also make another one where I can have single chart with 3 values in same chart using VBA. With different colors

  • @user-dd9lj4hu4x
    @user-dd9lj4hu4x Год назад

    HELLO, how can I plot the columns and align the plots next to each other instead of stack on top of each other?

  • @genson332
    @genson332 3 года назад

    Hi thank you very much for this information and detailed explanation. Can you help me to send all created graph to another sheet? I'm so sorry for asking too much. I hope you can help me. Thank you very much

  • @discozhang9353
    @discozhang9353 4 года назад +2

    I tried exactly same codes, but my charts got all the series instead of only one serie for each graph, is this happen to you before? Thanks a lot

    • @yaseminatalay1563
      @yaseminatalay1563 2 года назад +1

      Yes, happened to me. make sure your cursor is on a blank cell.

    • @nhlanhlamakondo5474
      @nhlanhlamakondo5474 2 года назад

      @@yaseminatalay1563 thank you , i was struglling with same problen

  • @viralkumarpatelkpcl339
    @viralkumarpatelkpcl339 3 года назад

    I wanted to create one chart with multiple Y variable. So how to create it??

  • @frevanneste7595
    @frevanneste7595 Год назад

    Hi, can I Add 2 types of Y values into 1 chart?

  • @davidedri4676
    @davidedri4676 3 года назад

    not working, it gets all columns in only one plot
    How can in the same code insert a selection of several columns with the same time base in one graph.

  • @ShyanakaDananjaya
    @ShyanakaDananjaya 3 года назад +2

    Solution for all the data in one plot: You can set the source data for the interested column by adding .SetSourceData Source:=ActiveSheet.Range("B2:B18") before .ChartType line which would get rid of all the data being plotted in the same chart.

  • @franciscomelendez3398
    @franciscomelendez3398 3 года назад

    not working, it gets all columns in only one plot

  • @yaseminatalay1563
    @yaseminatalay1563 2 года назад

    How can we add the charts on a separate worksheet and prevent them stacking on top of each other?

    • @karinaadcock
      @karinaadcock  2 года назад +2

      You probably want something like this: ruclips.net/video/AouNX275uyM/видео.html

    • @yaseminatalay1563
      @yaseminatalay1563 2 года назад

      @@karinaadcock Thank you - this is very helpful. I have one more question; what if there are more series for each chart. For example, what if the series repeat starting from row 21 with same date and same column titles but different values in each cell. I have a model output that repeats for 100 series and would like to plot them all. Thanks.

  • @0718364448
    @0718364448 Год назад

    How to include all three series in one chart