J
jclark419
Hey guys,
I am trying to create a chart of data based on the user's selection of
data. The code is below:
Code:
--------------------
Private Sub CommandButton1_Click()
Charts.Add
ActiveChart.ChartType = xlXYScatterLines
ActiveChart.SetSourceData Source:=Sheets("PFIR").range("A1:I3"), PlotBy:= _
xlRows
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = Worksheets("Data").range(Worksheets("Data").Cells(6, 2), Worksheets("Data").Cells(lastrow, 2))
ActiveChart.SeriesCollection(1).Values = Worksheets(reactorone).range(lineonerow, lineonecolumn)
ActiveChart.SeriesCollection(2).XValues = xtime
ActiveChart.SeriesCollection(2).Values = linetwo
ActiveChart.SeriesCollection(3).XValues = xtime
ActiveChart.SeriesCollection(3).Values = linethree
ActiveChart.SeriesCollection(4).XValues = xtime
ActiveChart.SeriesCollection(4).Values = linefour
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
--------------------
The line that spits back the error is:
Code:
--------------------
ActiveChart.SeriesCollection(1).XValues = Worksheets("Data").range(Worksheets("Data").Cells(6, 2), Worksheets("Data").Cells(lastrow, 2))
--------------------
It gives me an error saying something about object or application
undefined. I don't understand why this would possibly kick back an
error, I have specifically referenced each cell and lastrow is an
integer value.
Does anyone have any ideas?
~Jason
I am trying to create a chart of data based on the user's selection of
data. The code is below:
Code:
--------------------
Private Sub CommandButton1_Click()
Charts.Add
ActiveChart.ChartType = xlXYScatterLines
ActiveChart.SetSourceData Source:=Sheets("PFIR").range("A1:I3"), PlotBy:= _
xlRows
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = Worksheets("Data").range(Worksheets("Data").Cells(6, 2), Worksheets("Data").Cells(lastrow, 2))
ActiveChart.SeriesCollection(1).Values = Worksheets(reactorone).range(lineonerow, lineonecolumn)
ActiveChart.SeriesCollection(2).XValues = xtime
ActiveChart.SeriesCollection(2).Values = linetwo
ActiveChart.SeriesCollection(3).XValues = xtime
ActiveChart.SeriesCollection(3).Values = linethree
ActiveChart.SeriesCollection(4).XValues = xtime
ActiveChart.SeriesCollection(4).Values = linefour
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
--------------------
The line that spits back the error is:
Code:
--------------------
ActiveChart.SeriesCollection(1).XValues = Worksheets("Data").range(Worksheets("Data").Cells(6, 2), Worksheets("Data").Cells(lastrow, 2))
--------------------
It gives me an error saying something about object or application
undefined. I don't understand why this would possibly kick back an
error, I have specifically referenced each cell and lastrow is an
integer value.
Does anyone have any ideas?
~Jason