?
=?iso-8859-1?Q?Ulrike_Gr=F6mping?=
Dear all,
I'm trying to change the formulae in many line charts by
adding four points
to each chart, i.e. the old range goes through to
column "Z", the new range
is supposed to go through to column "AD".
Whenever I do this, the third series gets the data from
the first series
(subsequent series are ok again), and I have no clue, why
that might be the
case. Any ideas?
Regards, Ulrike
Code:
Sub makelonger()
For i = 12 To 19
For j = 1 To Worksheets(i).ChartObjects.Count
anz = Worksheets(i).ChartObjects
(j).Chart.SeriesCollection.Count
For k = 1 To anz
titel = Worksheets(i).ChartObjects
(j).Chart.Name
On Error GoTo naechste
formel =
Worksheets(i).ChartObjects(j).Chart.SeriesCollection
(k).Formula
formelneu = formel
If InStr(formel, "Z") > 0 Then _
formelneu = Left(formel, InStr
(formel, ":$Z")) & "$AD" & _
Right(formel, Len(formel) - InStr
(formel, "Z"))
If InStr(formelneu, "Z") > 0 Then _
formelneu = Left(formelneu, InStr
(formelneu, ":$Z")) & "$AD"
& _
Right(formelneu, Len(formelneu) - InStr
(formelneu, "Z"))
Worksheets(i).ChartObjects
(j).Chart.SeriesCollection(k).Formula
= formelneu
naechste:
Next k
Next j
Next i
End Sub
I'm trying to change the formulae in many line charts by
adding four points
to each chart, i.e. the old range goes through to
column "Z", the new range
is supposed to go through to column "AD".
Whenever I do this, the third series gets the data from
the first series
(subsequent series are ok again), and I have no clue, why
that might be the
case. Any ideas?
Regards, Ulrike
Code:
Sub makelonger()
For i = 12 To 19
For j = 1 To Worksheets(i).ChartObjects.Count
anz = Worksheets(i).ChartObjects
(j).Chart.SeriesCollection.Count
For k = 1 To anz
titel = Worksheets(i).ChartObjects
(j).Chart.Name
On Error GoTo naechste
formel =
Worksheets(i).ChartObjects(j).Chart.SeriesCollection
(k).Formula
formelneu = formel
If InStr(formel, "Z") > 0 Then _
formelneu = Left(formel, InStr
(formel, ":$Z")) & "$AD" & _
Right(formel, Len(formel) - InStr
(formel, "Z"))
If InStr(formelneu, "Z") > 0 Then _
formelneu = Left(formelneu, InStr
(formelneu, ":$Z")) & "$AD"
& _
Right(formelneu, Len(formelneu) - InStr
(formelneu, "Z"))
Worksheets(i).ChartObjects
(j).Chart.SeriesCollection(k).Formula
= formelneu
naechste:
Next k
Next j
Next i
End Sub