leal72
08-31-2009, 07:08 AM
I am trying to write code for the Macro to use a named range ("Load" and "Disp") to plot a series onto a chart.
I tried using .Range("E:E") but the graph is off because a couple of the cells that get selected have text
with the code below I get the
Run-time error '1004':
Application-defined or object-defined error
where it is in bold.
With ActiveSheet
' cell formatting here!
' find last row with data
LastRow = .Range("A65536").End(xlUp).Row
DataStart = FindTime + 2
For x = DataStart To LastRow
' more cell formattting and calclations here!
Next x
Range("E" & DataStart, ActiveCell.End(xlDown)).Name = "Load"
Range("F" & DataStart, ActiveCell.End(xlDown)).Name = "Disp"
End With
' plot chart data for each test specimen
Sheets("SummaryData").Select
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart.SeriesCollection.NewSeries
.Name = WsName
.Values = Sheets(WsName).Range("Load")
.XValues = Sheets(WsName).Range("Disp")
End With
I tried using .Range("E:E") but the graph is off because a couple of the cells that get selected have text
with the code below I get the
Run-time error '1004':
Application-defined or object-defined error
where it is in bold.
With ActiveSheet
' cell formatting here!
' find last row with data
LastRow = .Range("A65536").End(xlUp).Row
DataStart = FindTime + 2
For x = DataStart To LastRow
' more cell formattting and calclations here!
Next x
Range("E" & DataStart, ActiveCell.End(xlDown)).Name = "Load"
Range("F" & DataStart, ActiveCell.End(xlDown)).Name = "Disp"
End With
' plot chart data for each test specimen
Sheets("SummaryData").Select
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart.SeriesCollection.NewSeries
.Name = WsName
.Values = Sheets(WsName).Range("Load")
.XValues = Sheets(WsName).Range("Disp")
End With