PDA

View Full Version : ActiveChart.SeriesCollection(x) Referance



Jeff1959
04-02-2009, 03:03 AM
Hi all, Can anyone point me in the right direction? Im trying to referance the ActiveChart.SeriesCollection(x) number in an if statment but keep getting an error


If ActiveChart.SeriesCollection = x Then
Do This
Else
Do That
End If


Thanks for any help

Kenneth Hobs
04-02-2009, 05:48 AM
Where is the () in your code for the collection number inside?

Some of my code:
'http://www.mrexcel.com/forum/showthread.php?t=354580
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range, bc As Range, idx As Integer
Set r = Range("E23")
If Target.Address <> r.Address Then Exit Sub
idx = WorksheetFunction.Match(r, Range("B4:B19"))
Set bc = Range("B3")
Me.ChartObjects(1).Activate
With ActiveChart.SeriesCollection(1)
.Values = "=" & Me.CodeName & "!" & Range(bc.Offset(idx, 1), bc.Offset(idx, 9)).Address(True, True, xlR1C1)
.Name = "=" & Me.CodeName & "!" & bc.Offset(idx, 0).Address(True, True, xlR1C1)
End With
r.Select
End Sub