Run-time error 1004

R

rjc_29

hi

I have a macro created and i recently changed the following from

.Axes(xlValue, xlPrimary).TickLabels.NumberFormat = "0"

to

.Axes(xlValue, xlPrimary).TickLabels.NumberFormat = "0.0"

and now when i run the whole macro get a run-time error 1004

Method 'SeriesCollection' of object'_Chart' failed

end debug.

Any suggestions this is part of the macro relating to the create char
element

Private Sub CreateChart(stSheetName As String, stX_Values As String
stY_Values As String, _
stChartName As String, boCatVertical As Boolean)

Dim chNewChart As Chart

Set chNewChart = Charts.Add

With chNewChart
.ChartType = xlColumnClustered
With .SeriesCollection(1)
.XValues = Worksheets(stSheetName).Range(stX_Values)
.Values = Worksheets(stSheetName).Range(stY_Values)
.Name = stChartName
End With
.Location Where:=xlLocationAsNewSheet
.HasTitle = True
.ChartTitle.Characters.Text = stChartName
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Tim
Period"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Weighte
Probability Value"
.Axes(xlValue, xlPrimary).TickLabels.NumberFormat = "0.0"
.HasLegend = False
With .PlotArea.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
With .Axes(xlValue).MajorGridlines.Border
.ColorIndex = 2
.Weight = xlHairline
.LineStyle = xlContinuous
End With
With .SeriesCollection(1).Interior
.ColorIndex = 5
.Pattern = xlSolid
End With
.ChartTitle.Font.FontStyle = "Bold"
If boCatVertical = True Then
.Axes(xlCategory).TickLabels.Orientation = xlUpward
End If
End Wit
 
Top