0

I have this piece of VBA code

With sheet1.ChartObjects("Chart 2").Chart.Axes(xlValue)
        .MinimumScale = ChartMinY
        .MaximumScaleIsAuto = True
End With

When execution comes to .MinimumScale = ChartMinY where ChartMinY is 0.0844, excel throws an exception.

Err.Description is

Automation error
Unspecified error 

and Err.Number is -2147467259

It apparently works in Excel 2002

6
  • Do you mean ChartMinY is 0.0844?
    – Karan
    Sep 13, 2012 at 3:01
  • @Karan You're right! I have fixed the typo in the question Sep 13, 2012 at 3:05
  • Try hovering the mouse over that line and the preceding one, to check if any variable has an invalid value that might be the cause of this issue.
    – Karan
    Sep 13, 2012 at 3:08
  • 1
    Is your worksheet protected? support.microsoft.com/kb/983119
    – SeanC
    Sep 13, 2012 at 19:33
  • @SeanCheshire It is. If I unprotect before the call, it works. Please reproduce your comment as an answer so I can accept it. BTW, I have an automation error when I tried to set TickLabels.NumberFormat to "0.000" even after the sheet is unprotected. Is it also a known issue? Sep 13, 2012 at 23:56

1 Answer 1

1

Is your worksheet protected? http://support.microsoft.com/kb/983119

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .