ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MinimumScale method of Axis Object failed (https://www.excelbanter.com/excel-programming/426810-minimumscale-method-axis-object-failed.html)

Alex St-Pierre

MinimumScale method of Axis Object failed
 
Hi!
I have a macro that actualize a chart when the workbook is recalculate.
Using office 2007, I got an error (MinimumScale method of Axis Object has
failed). I don't know if this error is related to Office 2007 or not. I would
like to know if there's a way to avoid the error message (which happens not
very often). I have the same code in 4 sheets of the same workbook (each
sheet contains one graphic).
Thank you!
Alex

Private Sub Worksheet_Calculate()
With ChartObjects("Chart 1").Chart.Axes(xlValue)
.MinimumScale = Range("A51").Value
.MaximumScale = Range("A55").Value
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
End With
With ChartObjects("Chart 1").Chart.Axes(xlValue, xlSecondary)
.MinimumScale = Range("A51").Value - Range("C57").Value
.MaximumScale = Range("A55").Value - Range("C57").Value
End With
End Sub

--
Alex St-Pierre

Barb Reinhardt

MinimumScale method of Axis Object failed
 
I'd suggest you check the values you're plugging in. I wonder if the Maximum
value is less than the minimum.

HTH,
Barb Reinhardt

"Alex St-Pierre" wrote:

Hi!
I have a macro that actualize a chart when the workbook is recalculate.
Using office 2007, I got an error (MinimumScale method of Axis Object has
failed). I don't know if this error is related to Office 2007 or not. I would
like to know if there's a way to avoid the error message (which happens not
very often). I have the same code in 4 sheets of the same workbook (each
sheet contains one graphic).
Thank you!
Alex

Private Sub Worksheet_Calculate()
With ChartObjects("Chart 1").Chart.Axes(xlValue)
.MinimumScale = Range("A51").Value
.MaximumScale = Range("A55").Value
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
End With
With ChartObjects("Chart 1").Chart.Axes(xlValue, xlSecondary)
.MinimumScale = Range("A51").Value - Range("C57").Value
.MaximumScale = Range("A55").Value - Range("C57").Value
End With
End Sub

--
Alex St-Pierre



All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com