Hello,
I wrote a couple of macros using Excel 2007, which work fine there - but returns
"Run-time error '1004':
Unable to set the Values property of the Series class"
in Excel 2003.
I'm making a graph with cost on the x-axis, and probability on the y-axis.
I run a couple of scenarios, so for some the probability is 1 at a much higher cost than for others. The macro selects the data so that only the range of costs and probabilities where the probability is less than or equal 1 (for the first time) is used. Works great in 2007, but not in 2003!
I think it might be something to do with the strings?
The code is below. The line in red is where the code breaks
Sub maxPSA()
Dim TVal
Dim Cnt
Dim sh As Worksheet: Set sh = Sheets("PSA_Summary")
Application.ScreenUpdating = False
For Cnt = 15 To 165
If sh.Range("FH" & Cnt).Value = 1 Then
TVal = sh.Range("$FI$" & Cnt).Value
GoTo jd_End:
End If
Next Cnt
Application.ScreenUpdating = True
jd_End:
PSA_graph (TVal)
End Sub
Sub PSA_graph(TVal As String)
Dim sh As Worksheet: Set sh = Sheets("PSA_graphs")
sh.Activate
sh.ChartObjects("Chart 2").Activate
ActiveChart.SeriesCollection("Graph").Values = "='PSA_Summary'!$FH$15:$FH$" & TVal
End Sub
Thank you so much in advance!"
I wrote a couple of macros using Excel 2007, which work fine there - but returns
"Run-time error '1004':
Unable to set the Values property of the Series class"
in Excel 2003.
I'm making a graph with cost on the x-axis, and probability on the y-axis.
I run a couple of scenarios, so for some the probability is 1 at a much higher cost than for others. The macro selects the data so that only the range of costs and probabilities where the probability is less than or equal 1 (for the first time) is used. Works great in 2007, but not in 2003!
I think it might be something to do with the strings?
The code is below. The line in red is where the code breaks
Sub maxPSA()
Dim TVal
Dim Cnt
Dim sh As Worksheet: Set sh = Sheets("PSA_Summary")
Application.ScreenUpdating = False
For Cnt = 15 To 165
If sh.Range("FH" & Cnt).Value = 1 Then
TVal = sh.Range("$FI$" & Cnt).Value
GoTo jd_End:
End If
Next Cnt
Application.ScreenUpdating = True
jd_End:
PSA_graph (TVal)
End Sub
Sub PSA_graph(TVal As String)
Dim sh As Worksheet: Set sh = Sheets("PSA_graphs")
sh.Activate
sh.ChartObjects("Chart 2").Activate
ActiveChart.SeriesCollection("Graph").Values = "='PSA_Summary'!$FH$15:$FH$" & TVal
End Sub
Thank you so much in advance!"