Hi All,
I have a very simple column chart on a single sheet workbook in which I’m attempting to set horizontal axis max and min values using vba and it keeps throwing the following error:
Here is the code causing the error:
Option Explicit Public Sub ChartTEST() Dim cht As Chart Set cht = Sheets(“Sheet1”).ChartObjects(“Chart 1”).Chart ‘ set minimum value for y-axis With cht.Axes(xlValue) .MinimumScale = 3 End With ‘ set minium value for x-axis With cht.Axes(xlCategory) .MinimumScale = 0.9 End With End Sub
The code runs without error if I comment out the “.MinimumScale = 0” line following the line “With cht.Axes(xlCategory)”.
Here’s my chart and its data:
What am I missing? How do I prevent this error?
Cheers
Trevor