hhh79bigo
04-16-2014, 02:02 AM
Hi,
I am trying to write a macro that generates a graph/chart from specific data points in a spreadsheet, there should be two points in each series. Below is what I have written so far, however I get a runtime error "438" Object doesn't support this property or method. Where am I going wrong?
Thanks
O
Sub Mesh()
Dim n As Integer, i As Integer
n = Range("Q127")
'
Charts.Add
ActiveChart.ChartType = xlXYScatterLinesNoMarkers
For i = 1 To n
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).XValues = ActiveSheet.Range("R131", "T131").Offset(i)
ActiveChart.SeriesCollection(i).Values = ActiveSheet.Range("S131", "U132").Offset(i)
ActiveChart.Location Where:=xlLocationAsObject, Name:="Mesh"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
Next
End Sub
I am trying to write a macro that generates a graph/chart from specific data points in a spreadsheet, there should be two points in each series. Below is what I have written so far, however I get a runtime error "438" Object doesn't support this property or method. Where am I going wrong?
Thanks
O
Sub Mesh()
Dim n As Integer, i As Integer
n = Range("Q127")
'
Charts.Add
ActiveChart.ChartType = xlXYScatterLinesNoMarkers
For i = 1 To n
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).XValues = ActiveSheet.Range("R131", "T131").Offset(i)
ActiveChart.SeriesCollection(i).Values = ActiveSheet.Range("S131", "U132").Offset(i)
ActiveChart.Location Where:=xlLocationAsObject, Name:="Mesh"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
Next
End Sub