Hello,
Thanks for helping.
I'm getting a
Runtime Error '91'
Object variable or With Block variable not set.
when I run a button that creates a pie chart from a set of data:
When I hit debug, this is what highlights:
ActiveChart.ChartType = xlPie
Sub Chart_Earnings() 'Pie chart for earnings
Dim Sheetname As String
Sheetname = ActiveSheet.Name
Call DeleteCharts
Range("J21,A1:A6,C1:C6").Select
Range("C6").Activate
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Sheets(Sheetname).Range("A1:A6,C1:C6"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:=Sheetname
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlRight
End Sub
Do you have any idea what is wrong?
Thank you.
Bookmarks