Hello.
I have this code to export a query to excel and create a chart.
The code is working fine:
Set ch = ws.Shapes.AddChart.Chart
With ch
.ChartType = xlColumnClustered
.SeriesCollection(2).AxisGroup = 2
.SeriesCollection(2).ChartType = xlLineMarkers
.ChartGroups(1).GapWidth = 69
.Axes(xlValue).MajorGridlines.Delete
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
.SetElement (msoElementLegendBottom)
End With
However, when I type beneat this code to set set maximun and minimum axis carth values
.Axes(xlCategory, xlPrimary).MaximumScale = Chart1.Range("Axis_max").Value
.Axes(xlCategory, xlPrimary).MaximumScale = Chart1.Range("Axis_max").Value
the following line always there is the Object required error '424':
.Axes(xlCategory, xlPrimary).MaximumScale = Chart1.Range("Axis_max").Value
I hope someone can help,
All the best
Bookmarks