+ Reply to Thread
Results 1 to 5 of 5

Update Chart Axes VBA

  1. #1
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Update Chart Axes VBA

    First off, I have posted this question on mrexcel.com, but have not been able to get any responses (http://www.mrexcel.com/forum/showthread.php?t=581652).


    I have a dashboard that I have created where the user can chart out different metrics over a period of time that they select. The metrics themselves could be in the millions, or a %. So, the code that I am trying to use will update the chart based on the selections and update the axis, as well as place certain metrics on the secondary axis if necessary.

    Here is the code that I am using:

    Please Login or Register  to view this content.
    However, I am getting an error stating "Method 'Axes' of object '_Chart' failed" with this line highlighted:

    Please Login or Register  to view this content.
    However, I am not understanding why it isn't working. I have used this method in the past, and can't figure out why it is breaking at this point.

    Any help is appreciated.
    Last edited by Claymation; 09-28-2011 at 12:29 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,725

    Re: Update Chart Axes VBA

    Does the chart already have a secondary value axis? If not, you will get that error on that line of code.

    Do you have an error number for the error?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Re: Update Chart Axes VBA

    The error is "Run-Time Error '-2147467259 (800004005)'

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,725

    Re: Update Chart Axes VBA

    That's the same error I got when I tried to execute it against a chart with no secondary axis.

  5. #5
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Re: Update Chart Axes VBA

    That was the issue. I had set one of the main lines in my chart to the secondary axis, but it was moved back to the primary when I made an update. I have since added in a static line to the chart over the same range so that it is always there.

    Thanks for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1