S
steph00
I wrote a program that worked fine. The program plots data. My files
were moved from an old computer to a new one by my system
administrator. I have no idea why the program is not working. The work
book is not protected.
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:="TC1_SCALED"
Range("A1").CurrentRegion.Copy Sheets("Sheet3").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
the first set of data copies to sheet to, but I get the error for the
next set of data. Please HELP!
were moved from an old computer to a new one by my system
administrator. I have no idea why the program is not working. The work
book is not protected.
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:="TC1_SCALED"
Range("A1").CurrentRegion.Copy Sheets("Sheet3").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
the first set of data copies to sheet to, but I get the error for the
next set of data. Please HELP!