cheakrisna
New Member
- Joined
- Jan 15, 2005
- Messages
- 22
I got a "Run-time error '1004': Method 'Axes' of object '_Chart' failed" dialog everytime i run the macro below
Sub creatingchart()
Charts.Add
ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
"Line - Column on 2 Axes"
ActiveChart.SetSourceData Source:=Sheets("don").Range("B1:E11,G1:G11"), _
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = "=don!R2C2:R11C4"
ActiveChart.SeriesCollection(2).Values = "=don!R2C5:R11C5"
ActiveChart.SeriesCollection(2).Name = "=don!R1C5"
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Chart1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Title"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
"Category"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "MB/sec"
.Axes(xlCategory, xlSecondary).HasTitle = False '*****got error****
.Axes(xlValue, xlSecondary).HasTitle = True
.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = _
"Log times"
End With
end sub
It seems that excel doesn't support this type of chart. Please help
I'd appreciate it.
Chris
Sub creatingchart()
Charts.Add
ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
"Line - Column on 2 Axes"
ActiveChart.SetSourceData Source:=Sheets("don").Range("B1:E11,G1:G11"), _
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = "=don!R2C2:R11C4"
ActiveChart.SeriesCollection(2).Values = "=don!R2C5:R11C5"
ActiveChart.SeriesCollection(2).Name = "=don!R1C5"
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Chart1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Title"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
"Category"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "MB/sec"
.Axes(xlCategory, xlSecondary).HasTitle = False '*****got error****
.Axes(xlValue, xlSecondary).HasTitle = True
.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = _
"Log times"
End With
end sub
It seems that excel doesn't support this type of chart. Please help
I'd appreciate it.
Chris