+ Reply to Thread
Results 1 to 4 of 4

changing chart scale with VBA

  1. #1
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    changing chart scale with VBA

    How would I change a chart's scale with VBA? Right now I have the following:

    Please Login or Register  to view this content.
    and would like to do this without excel physically selecting the chart (first line of code, but have it simply change the value of max and min.

    Thank you.

  2. #2
    Registered User
    Join Date
    07-18-2008
    Location
    India
    Posts
    68

    changing chart scale with VBA

    Hi,

    Following code is working fine with my chart. Hope it would be useful for you as well.

    Public Sub mychart()
    Dim thechart As ChartObject

    Set thechart = Sheet1.ChartObjects("Chart 1")
    thechart.Chart.Axes(xlValue).MinimumScale = 6
    thechart.Chart.Axes(xlValue).MaximumScale = 26

    End Sub

  3. #3
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679
    That works! Thank you.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Rubeus,

    Please read the Forum Rules, and wrap code with Code Tags.

+ 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