![]() |
|
#2
|
|||
|
|||
|
in this case,I want to use the result of macro range(d1:d6) and range(g1:g6) to draw the histogram,so I copy the two columns data to columns k and l from cells k1.because macro quote the range("k1:l6")can produce the good look histogram.
the result is like this: 20200827120613.png use the code as follows: Sub AddChart1() Dim chtChart As Chart Set chtChart = Charts.Add With chtChart .SetSourceData Source:=Sheet1.Range("K1:L6"), PlotBy:=xlRows .ChartType = xlColumnClustered .HasDataTable = True .ApplyDataLabels .HasTitle = True .ChartTitle.Text = "histogram" .HasLegend = True .Name = "histogram" End With Set chtChart = Nothing End Sub |
| Tags |
| histogram |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to draw the histogram? | leeqiang | Excel Programming | 1 | 08-27-2020 05:19 PM |
Frequency of Count Ifs
|
keeble | Excel | 4 | 02-01-2017 10:33 AM |
| Formula to calculate Frequency | lwls | Excel | 1 | 03-30-2015 05:40 AM |
Trying to count frequency
|
borninscorpio | Excel | 4 | 07-31-2013 12:44 AM |
| Frequency of a name | bryant03 | Excel | 1 | 06-27-2012 10:21 AM |