Run Time error 1004

S

Steph

I wrote a program to plat a large set of data. The program auto filters
through the data and then stores each criteria I set in another sheet. For
example I filter for TCO and store in sheet 2. My program worked fine until I
mived the file to a new computer. Now I am getting a run time error. Why
could this be???

Sheets("Sheet1").Select
Cells.Select

Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="TC0_SCALED"
Range("A1").CurrentRegion.Copy Sheets("Sheet2").Range("A1")



Sheets("Sheet1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="TC2_SCALED"
Range("A1").CurrentRegion.Copy Sheets("Sheet4").Range("A1")

Sheets("Sheet1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="TC3_SCALED"
Range("A1").CurrentRegion.Copy Sheets("Sheet5").Range("A1")

Sheets("Sheet1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="TC4_SCALED"
Range("A1").CurrentRegion.Copy Sheets("Sheet6").Range("A1")

Sheets("Sheet1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="TC5_SCALED"
Range("A1").CurrentRegion.Copy Sheets("Sheet7").Range("A1")

Sheets("Sheet1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="PYRO_SCALED_VAL"
Range("A1").CurrentRegion.Copy Sheets("Sheet8").Range("A1")


Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:I64810"), _
PlotBy:=xlRows

ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=Sheet2!C5"
ActiveChart.SeriesCollection(1).Values = "=Sheet2!C4"
ActiveChart.SeriesCollection(1).Name = "=""TC0_SCALED"""


ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = "=Sheet3!C5"
ActiveChart.SeriesCollection(2).Values = "=Sheet3!C4"
ActiveChart.SeriesCollection(2).Name = "=""TC1_SCALED"""



ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).XValues = "=Sheet4!C5"
ActiveChart.SeriesCollection(3).Values = "=Sheet4!C4"
ActiveChart.SeriesCollection(3).Name = "=""TC2_SCALED"""


ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).XValues = "=Sheet5!C5"
ActiveChart.SeriesCollection(4).Values = "=Sheet5!C4"
ActiveChart.SeriesCollection(4).Name = "=""TC3_SCALED"""


ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(5).XValues = "=Sheet6!C5"
ActiveChart.SeriesCollection(5).Values = "=Sheet6!C4"
ActiveChart.SeriesCollection(5).Name = "=""TC4_SCALED"""


ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(6).XValues = "=Sheet7!C5"
ActiveChart.SeriesCollection(6).Values = "=Sheet7!C4"
ActiveChart.SeriesCollection(6).Name = "=""TC5_SCALED"""


ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(7).XValues = "=Sheet8!C5"
ActiveChart.SeriesCollection(7).Values = "=Sheet8!C4"
ActiveChart.SeriesCollection(7).Name = "=""PYRO_SCALED_VAL"""

ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Plot1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Thermocouple Data"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Temperature"
End With
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScaleIsAuto = True
.MaximumScale = 8000
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top