austin350s10
Active Member
- Joined
- Jul 30, 2010
- Messages
- 321
How can I adjust the following code so that both arrays will work? Currently this code loops through both arrays completely before finishing. Basically, what I am looking for here is a way to assign a charts title based on the findings of the GraphName array.
So when in position 0 of the GraphName array the chart title should use the title at position 0 of the GraphTitle array.
How can I fix this?
So when in position 0 of the GraphName array the chart title should use the title at position 0 of the GraphTitle array.
How can I fix this?
Code:
GraphTitle = Array("Actual Hours vs. Goal Hours", "Actual Days vs. Goal Days")
GraphName = Array("H1", "H2")
For r = 0 To UBound(GraphTitle)
For i = 0 To UBound(GraphName)
Set MyChart = ActiveSheet.ChartObjects(GraphName(i)).Chart
' stuff with GraphName(i) here
MyChart.SetElement (msoElementChartTitleAboveChart)
MyChart.ChartTitle.Text = GraphTitle(r)
Next i
Next r