VBA code only working for some charts
<p>My VBA code for updating the secondary axes range on all graphs of a worksheet only works for some of the graphs. After the macro is run, the message "Method 'Axes' of object '_Chart' failed" is displayed, with only some of the graphs on that worksheet being updated. What's the problem here?</p>

<pre><code>Sub Macro1()

Dim objChart As ChartObject, lower As Double, upper As Double

lower = Application.InputBox(prompt:="Enter lower bound", Type:=1)
upper = Application.InputBox(prompt:="Enter upper bound", Type:=1)

For Each objChart In Sheets("Summary").ChartObjects
    With objChart.Chart.Axes(xlValue, xlSecondary)
        .MinimumScale = lower
        .MaximumScale = upper
    End With
Next objChart

End Sub
</code></pre>