• Excel 2010 VBA Run-Time Error ‘-2147467259 (80004005)’: Setting Chart Axis

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Excel 2010 VBA Run-Time Error ‘-2147467259 (80004005)’: Setting Chart Axis

    Author
    Topic
    #1773386

    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:

    Code:
    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

    Reply To: Excel 2010 VBA Run-Time Error ‘-2147467259 (80004005)’: Setting Chart Axis

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: