View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jclark419[_7_] jclark419[_7_] is offline
external usenet poster
 
Posts: 1
Default Error Creating Chart


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 Whe=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


--
jclark419
------------------------------------------------------------------------
jclark419's Profile: http://www.excelforum.com/member.php...o&userid=25430
View this thread: http://www.excelforum.com/showthread...hreadid=558543