Apologies aside, my problem has become quite the curiousity and I can't find any answers as of yet.
A piece of my program is designed to search through a graph to see if a series already exists, and if it doesn't, it creates it. As of now the program is fine and dandy. HOWEVER, in doing so for 8 different graphs, the code is not only long, but could potentially be more inefficient. So, I decided to attempt to loop through an array. This is what one of the graphing blocks looks like:
EDIT: I didn't specifically say, but Z IS the name of a sheet AND the name of the series, as defined earlier in the code, so that is not an issue.
Sheets("A").Select
Count = ActiveChart.SeriesCollection.Count
Fail = 0
For c = 1 To Count
If ActiveChart.SeriesCollection(c).Name = Z Then
With ActiveChart.SeriesCollection(c)
.Values = Worksheets(Z).Range("AJ5:AJ45")
.XValues = Worksheets(Z).Range("AP5:AP45")
End With
Exit For
Fail = Fail - 1
End If
Fail = Fail + 1
Next c
If Fail = Count Then
ActiveChart.SeriesCollection.NewSeries
c = ActiveChart.SeriesCollection.Count
With ActiveChart.SeriesCollection(c)
.Values = Worksheets(Z).Range("AJ5:AJ45")
.XValues = Worksheets(Z).Range("AP5:AP45")
.Name = Z
.MarkerStyle = 1
.MarkerSize = 9
End With
End If
(With 7 more of those underneath, with different sheets and Y values). SO, I tried this:
Dim SheetArr(0 To 7) As Sheets
Set SheetArr(0) = Sheets("A")
Set SheetArr(1) = Sheets("B")
etc..
Dim RangeArr(0 To 7) As Range
Set RangeArr(0) = Range("AJ5:AJ45")
Set RangeArr(1) = Range("AK5:AK45")
etc..
And starting a loop, replacing individual values with SheetArr(i) and RangeArr(i) respectively so only one block of code exists, but none of the graphs even begin plotting. Am I dimming arrays wrong, or is this just not possible?
(Sorry for a super long post, just trying to be as clear as possible.)