+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    01-11-2006
    Posts
    19

    Charting Macro worked in 2003 but not in 2007

    Hey everyone,

    I'm new to Excel 2007 so I'm not sure how to change this code such that it works. I realize that some of the options available in 2003 are no longer available in 2007, however, I would like to preserve the functionality of this particular macro. Is it possible?

    Thanks, Paula

    EDIT: So, I've tried to play around a little more with the macro and it seems that it runs the first time, however I have to manuall adjust the Minimum and Maximum scales manually and set them to auto before the macro actually works. Is there a way around this? Why isn't the macro activating the auto scale?
    ___________________________________

    Here's what I had in the 2003 version:
    Code:
    Sub Center_Cashflow_Axis()
    
    ' Macro recorded 5/7/2008 by  Paula Brozek
    ' This Macro is designed to automatically center the axis for the cashflow diagram in the graphs worksheet
    
    
    Worksheets("Graphs").ChartObjects("Chart 2").Activate
        With ActiveChart.Axes(xlValue)
            .MinimumScaleIsAuto = True
            .MaximumScaleIsAuto = True
        End With
        With ActiveChart.Axes(xlValue, xlSecondary)
            .MinimumScaleIsAuto = True
            .MaximumScaleIsAuto = True
        End With
        ActiveChart.Refresh
        With ActiveChart.Axes(xlValue)
            .MinimumScaleIsAuto = False
            .MaximumScaleIsAuto = False
            If (.MinimumScale + .MaximumScale) > 0 Then
              .MinimumScale = -.MaximumScale
            Else
              .MaximumScale = -.MinimumScale
            End If
        End With
        With ActiveChart.Axes(xlValue, xlSecondary)
            .MinimumScaleIsAuto = False
            .MaximumScaleIsAuto = False
            If (.MinimumScale + .MaximumScale) > 0 Then
              .MaximumScale = -.MinimumScale
            Else
              .MinimumScale = -.MaximumScale
            End If
        End With
    End Sub
    Last edited by paulabrozek; 09-02-2009 at 01:54 PM. Reason: Added Code tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,497

    Re: Charting Macro worked in 2003 but not in 2007

    Hello paulabrozek,

    To make your posts easier to read, copy, and edit please wrap your code. I did it for you this time. Here is how you can do it next time.

    How to wrap your Code
    1. Select all your code using the mouse.
    2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.

    OR you can also do this Manually by placing the tags
    [code] at the start of the first line,
    [/code] at the end of the last line.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

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.2.0