How to make multiple charts in excel using vba
ฝัง
- เผยแพร่เมื่อ 25 ส.ค. 2024
- 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.co...
Different chart types in excel vba: bettersolution...
---------------------------------------------------------------------------------
#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 ...
Hope you learnt something new and interesting. Thanks for watching and please Like, Comment and Subscribe.
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!
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.
Thank you sooo much Madam! Very clear, easily understandable, clear video and audio !
would be happy for more tutorials !
Cheers !
Great demonstration. Nice, clear description. Thanks !
Thanks for your amazing work. This was a terrific example of Macros.
Dear Ms Karina, clear brilliant explanation ! btw your pleasant voice makes this tutorial easy to graps
Thank you so much Karina, Lord Jesus bless you!
Thanks, this is very helpful.
thx a lot, this is so useful
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?
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
Yes, happened to me. make sure your cursor is on a blank cell.
@@yaseminatalay1563 thank you , i was struglling with same problen
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
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
HELLO, how can I plot the columns and align the plots next to each other instead of stack on top of each other?
May I please know how to add trendline with equation in VBA as well? thanks a lot
Thanks, very helpful! What if I have different X axis? Could you suggest?
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.
I wanted to create one chart with multiple Y variable. So how to create it??
Hi, can I Add 2 types of Y values into 1 chart?
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
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.
not working, it gets all columns in only one plot
How can we add the charts on a separate worksheet and prevent them stacking on top of each other?
You probably want something like this: th-cam.com/video/AouNX275uyM/w-d-xo.html
@@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.
How to include all three series in one chart