创builddynamic饼图

我正在尝试创build一个dynamic饼图。 下面的代码只对固定范围做这项工作。 我的问题是我必须从上次使用的行中获取数据,并将其作为图表的input。 而且我无法更改图表中的标签。

Sub Chart() With ActiveSheet.ChartObjects.Add(Left:=440, Width:=310, Top:=475, Height:=200) With .Chart .SetSourceData Source:=ActiveSheet.Range("G16:K16") .ChartType = xl3DPie .HasTitle = True .ApplyDataLabels Type:=xlDataLabelsShowLabelAndPercent .ChartTitle.Characters.text = "Summary Report" .ChartTitle.Characters.Font.Size = 10 .ChartTitle.Characters.Font.Bold = True .HasLegend = False .RightAngleAxes = True With .ChartArea With .Border .Weight = 2 .LineStyle = 0 End With With .Interior .ColorIndex = 39 .PatternColorIndex = 1 .Pattern = 1 End With End With With .PlotArea With .Border .Weight = 2 .LineStyle = 0 End With With .Interior .ColorIndex = 39 .PatternColorIndex = 1 .Pattern = 1 End With End With End With End With 

结束小组

还有一件事是我想在最后一行之后放置三行