I am trying to create a dynamic pie chart. The below does code does the job only for fixed ranges. My problem is I have to fetch the data from last used row and give it as the input for chart. And I cannot change the labels in chart.
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
End Sub
And one more thing is that I want place the chart exactly three rows after the last row