+ Reply to Thread
Results 1 to 3 of 3

Excel Chart Axis Auto-Update based on cells with calculated range

  1. #1
    Registered User
    Join Date
    04-30-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2007
    Posts
    51

    Excel Chart Axis Auto-Update based on cells with calculated range

    Hi - I have a workbook with a number of sheets, each which have a single chart, which the organization I work for use to create a standardized report for clients. Each client provides us with a different data set (from a survey), and thus the chart ranges / origin need to change with each new data set.

    All charts across the different sheets use the same Range / Origin from the dataset.

    I found this Macro in a previous forum which seems to work for one chart, and one sheet. Any way to tweak this so that it works for all charts (or perhaps just more than 1 chart), all sheets?

    Private Sub SetAxisScales()
    With ActiveSheet.ChartObjects("Chart 1").Chart
    With .Axes(xlValue)
    .MaximumScale = ActiveSheet.Range("Ymax").Value
    .MinimumScale = ActiveSheet.Range("Ymin").Value
    .MajorUnit = ActiveSheet.Range("Ymajor").Value
    .MinorUnit = ActiveSheet.Range("Yminor").Value
    End With
    End With
    End Sub

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Excel Chart Axis Auto-Update based on cells with calculated range

    Hi Jgray,

    Please take a moment to read the forum rules and then add code tags around your code. Also, I'm moving this thread to the Programming forum as it involves macros. In the future, please pick the appropriate forum to post in.

    Thank you.

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

    Re: Excel Chart Axis Auto-Update based on cells with calculated range

    This should do the trick, all charts, all sheets:
    Please Login or Register  to view this content.
    Also please use [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags around code.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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