You must not have a secondary value (Y) axis in the chart. Change
xlSecondary to xlPrimary.
- Jon
-------
Jon Peltier, Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/>
Advanced Excel Conference - Training in Charting and Programming
http://peltiertech.com/Training/2009...00906ACNJ.html
_______
"Ayo" <(E-Mail Removed)> wrote in message
news:38224F15-37CD-4144-A226-(E-Mail Removed)...
> Could someone help me figure out this error message:
>
> " Method 'Axes' of object '_Chart' failed "
>
> I am getting the error on the line: " With .Axes(xlValue, xlSecondary) "
> in
> the following code segment.
>
> Sub createChart()
> Dim ChtObj As ChartObject
> Dim ChtName As String
>
> Set ChtObj = ActiveSheet.ChartObjects.Add(Left:=375, Top:=7, Width:=575,
> Height:=360)
>
> With ChtObj.Chart
> .ChartType = xlColumnClustered
> .Legend.Position = xlLegendPositionBottom
> .SetSourceData Source:=ActiveSheet.Range("$K$26:$L$40")
>
> With .SeriesCollection.NewSeries
> .Values = Sheets("SAP# 13195").Range("$M$26:$M$40")
> .XValues = Sheets("SAP# 13195").Range("$K$26:$K$40")
> .Name = "Cumulative Quantity"
> .ChartType = xlLineMarkers
>
> End With
>
> With .Axes(xlValue, xlSecondary)
> .MaximumScale = dYmax ' Constant value
> .MinimumScale = dYmin ' VBA variable
> .MajorUnit = 50
> End With
>
> End With
>
> End Sub