+ Reply to Thread
Results 1 to 5 of 5

Worksheet Event - update chart axis scale, depending on cell value

  1. #1
    Registered User
    Join Date
    08-07-2013
    Location
    Cardiff
    MS-Off Ver
    Office 365
    Posts
    86

    Worksheet Event - update chart axis scale, depending on cell value

    Hi

    On a sheet I have a simple pivot table with Year (Row), £ Sales (Values), and Product Type (Report Filter).

    I then have a Line chart running off this.


    I'm trying to write a code so when the Product Type filter changes, the chart axis scales update depending on a Cell (C1) which simple diplays which Product is selected.
    Basically, I want it to also be 'Auto' unless "All Hard Goods" are selected, whereby I want the scale to be Min: 2000000 and Max: 3000000.

    I'm fairly new to vba, and so far I've tried these, with no luck:


    This doesn't do what I need:
    Please Login or Register  to view this content.

    And this comes up with Compile Error: Object Required:
    Please Login or Register  to view this content.
    Any help would be most appreciated. Thanks

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Worksheet Event - update chart axis scale, depending on cell value

    You must use:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Registered User
    Join Date
    08-07-2013
    Location
    Cardiff
    MS-Off Ver
    Office 365
    Posts
    86

    Re: Worksheet Event - update chart axis scale, depending on cell value

    Thanks Izandol
    I guess you mean on the worksheet_PivotTableUpdate version?

    I've tried that, but now it says 'Run time error 9: Subscript out of range?

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Worksheet Event - update chart axis scale, depending on cell value

    So you do not have sheet called 'Sheet 1' (usually there will not be space) or chart object called 'Chart 1'.

  5. #5
    Registered User
    Join Date
    08-07-2013
    Location
    Cardiff
    MS-Off Ver
    Office 365
    Posts
    86

    Re: Worksheet Event - update chart axis scale, depending on cell value

    Ah yes! Its called "Sheet1".

    Thanks you! Works a treat

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help with VBA to update y-axis scale in graphs
    By clockhart10 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-29-2014, 12:02 PM
  2. [SOLVED] Setting Chart Axis Scale by referencing a cell in the worksheet
    By Grimace in forum Excel Charting & Pivots
    Replies: 11
    Last Post: 11-19-2013, 11:23 AM
  3. X-Y axis scale auto-update
    By Ralem in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 01-08-2011, 08:12 PM
  4. [SOLVED] How do I reference x-axis or y-axis scale values to a worksheet ce
    By retro5726 in forum Excel General
    Replies: 0
    Last Post: 08-09-2006, 08:54 PM
  5. Replies: 0
    Last Post: 08-09-2006, 08:49 PM

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