Chopper
06-25-2001, 02:16 PM
Hey everyone, I have a problem which is getting on my nerves, I need to create a graph in excel using a macro, I do it with this code
Range("F59:J60").Select
Charts.Add
ActiveChart.ChartType = xl3DPieExploded
ActiveChart.SetSourceData Source:=Sheets("The questionnaire").Range("F59:J60" _
), PlotBy:=xlRows
ActiveChart.Location Where:=xlLocationAsObject, Name:="The questionnaire"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Question 3:"
End With
ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowPercent, LegendKey:=False _
, HasLeaderLines:=True
And it doesnt seem to be working it seems to find a problem with the charts.add part, is there any reason for this, I have even copied an example from the text book and it still will not work, please help me in my time of need.
Range("F59:J60").Select
Charts.Add
ActiveChart.ChartType = xl3DPieExploded
ActiveChart.SetSourceData Source:=Sheets("The questionnaire").Range("F59:J60" _
), PlotBy:=xlRows
ActiveChart.Location Where:=xlLocationAsObject, Name:="The questionnaire"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Question 3:"
End With
ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowPercent, LegendKey:=False _
, HasLeaderLines:=True
And it doesnt seem to be working it seems to find a problem with the charts.add part, is there any reason for this, I have even copied an example from the text book and it still will not work, please help me in my time of need.