help with chart for loop

steve_bris

Registered User.
Local time
Tomorrow, 08:03
Joined
Mar 22, 2005
Messages
30
Hi.

I need to scroll throught a few charts on a page and set the max value of any of the charts to be the max scale of all the charts.

I have used the following VBA code and it doesn't work. The mymax value doesn't seem to record the maximum value of any graph.

Any help....especially if it can be pretty soon :).... would be hugely appreciated :)

Thanks heaps
Steve

Dim Co as integer
Dim mymax as integer
Dim m as integer
Dim a as variant
Dim l as integer

Code:
       Co = 1                                                            ' chart object no 1
       mymax = 1

        Do
        Worksheets("Platform" & LoopNo).ChartObjects(Co).Select           ' select chart object Co
            For m = 1 To ActiveChart.SeriesCollection.count
                 a = ActiveChart.SeriesCollection(m).Values
                 For l = 1 To a.Points
                     If mymax < a(l) Then mymax = a(l)
                 Next l
             Next m

        Co = Co + 1                                                         ' next chart
        Loop Until Co = intSelCrtNo                                    ' intSelCrtNo is an integer from another part of the code
 

Users who are viewing this thread

Back
Top Bottom