View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
BHatMJ BHatMJ is offline
external usenet poster
 
Posts: 26
Default unable to set the values property of the series class

Thank you Ethoros but, inexplicably, it still does not work. When I set
..Formula = "=d4:bk4", it places a text box with the formula string on the
chart.

"Ethoros" wrote:

This code should help you. it finds and replaces text in in series.

<code
Sub Chart_Series_Replacer()


If ActiveSheet.chartobjects.Count 0 Then
S_Str = InputBox("Please input string you wish to find", "Search Text")
R_Str = InputBox("Please input string you wish to Replace With",
"Replace Text")
For i = 1 To ActiveSheet.chartobjects.Count
With ActiveSheet.chartobjects(i).Chart
For intSeries = 1 To .SeriesCollection.Count
strData = .SeriesCollection(intSeries).Formula
strData = Replace(UCase(strData), UCase(S_Str), UCase(R_Str))
.SeriesCollection(intSeries).Formula = strData
Next
End With
Next i
End If
End Sub
</code

"BHatMJ" wrote:

Thank you for your help but .Formula did not work. The following code seems
to work but will sporadically lock up and then cause the error:

Worksheets(1).ChartObjects(1).Chart.SeriesCollecti on(3).Values = _
Worksheets(2).Range("D3:BK3")

It seems as if all of these should work and I cannot understand why a series
seems to "lock up" after several runs of the program. Once "locked", it
always creates the error. If I delete the chart and re-create a new one, the
code works again.

Can anyone explain or help?


"Ethoros" wrote:

Try

ActiveChart.SeriesCollection(1).Formula = "=results!R4C4:R4C63"

instead of values

"BHatMJ" wrote:

I get this error message "unable to set the Values property of the Series
class" when trying to re-set a chart series to another range. Can anyone
help?

CODE:

Worksheets("analyze").ChartObjects("resChart").Act ivate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(1).Values = "=results!R4C4:R4C63"