"Run-time error '1004': Unable to set the Values property of the Series class"

bexcel

New Member
Joined
Sep 22, 2010
Messages
3
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!"
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,224,537
Messages
6,179,405
Members
452,911
Latest member
a_barila

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top