+ Reply to Thread
Results 1 to 4 of 4

VBA Code to Change Chart Range based on new row number count

  1. #1
    Registered User
    Join Date
    09-01-2015
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Pro Plus 2010
    Posts
    33

    VBA Code to Change Chart Range based on new row number count

    Hi - Hope I can explain my problem easily enough.

    Sheet 1 has a chart, the chart range is (currently pre-defined) as Sheet 3 range $B$3:$X$26. This has lots of data and formulas from other sheets.
    Data is input onto Sheet 2, with a row counter (Sheet 2, $C$75) currently at 24. Sheet 3 grabs the data from Sheet 2 and updates all the info based on Sheet 2 (and others).
    When new data is added on Sheet 2, the row counter adds it.

    I need a VBA code so that when I add data to Sheet 2 (and the counter moves from 24 to 25), then the range of the Chart on Sheet 1 must automatically update to Sheet 3, $B$3:$X$27.

    I hope I am making sense.
    Thanks.

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: VBA Code to Change Chart Range based on new row number count

    Why not make the DATA a table and it will automatically adjust?
    Or you can use a dynamic named range and avoid VBA altogether.
    https://www.google.com/webhp?sourcei...ynamic%20range
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    09-01-2015
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Pro Plus 2010
    Posts
    33

    Re: VBA Code to Change Chart Range based on new row number count

    Hi. Thanks for the response.
    I have investigated tables, Pivot Tables, etc, and also dynamic named ranges, extensively.
    Because of the "extreme complexity" of my workbook (over 50 sheets, in excess of 4.5 MB), and extremely complex formulas and references, these methods don't seem to work.
    Given a lot of thought into it, and a VBA code changing the range based on a simple number (count of rows) is the simplest method.
    Thanks all the same.

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: VBA Code to Change Chart Range based on new row number count

    I will agree to disagree as I have had excel workbooks over 2GBs and over 100 sheets that work perfectly fine with a table or a dynamic named range OR vba.
    I just like to keep things as simple as possible before going to the VBA route (and sometimes THAT is the most simple path).

    Also if you posted a sample workbook I would be more likely to offer concrete help applicable to your EXACT situation instead of suggestions.

+ 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. Replies: 2
    Last Post: 10-30-2015, 01:15 PM
  2. Replies: 2
    Last Post: 01-15-2015, 10:16 AM
  3. Replies: 4
    Last Post: 07-09-2012, 04:15 PM
  4. [SOLVED] count the number of times a string occurs in a range based on a condition
    By sshishirkumar in forum Excel General
    Replies: 6
    Last Post: 05-29-2012, 04:00 AM
  5. [SOLVED] Change range in formula based on changing row count
    By razz0807 in forum Excel General
    Replies: 6
    Last Post: 04-18-2012, 09:51 AM
  6. VBA Code Conditional Formatting based on number range
    By LMS0214 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-05-2011, 03:08 PM
  7. [SOLVED] Count number of cells based on 2 selections in the same range.
    By jilaba in forum Excel - New Users/Basics
    Replies: 12
    Last Post: 02-16-2010, 11:22 AM

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