+ Reply to Thread
Results 1 to 5 of 5

Resizing Chart Data Range Size

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Resizing Chart Data Range Size

    Hi Guys
    In the attached file...

    Userform pops up select a few values and charts get updated...

    I am trying to get the source data for bottom chart to be the same size as the top chart...
    depending on the user selections, you will notice that the bottom charts data source is always out...Range size is not consistent...Any ideas how I can have both with same size...

    Herewith code that controls...NB the code contains functions that can only work with V10 upwards..
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sintek; 11-08-2018 at 10:32 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Resizing Chart Data size

    I notice that as soon as the Means in smaller than the std dev then the bottom charts data range become inconsistent
    There must be a way to re-size the HistData2.range
    Columns AD:AE must resize to the size of Columns Y:Z
    Last edited by sintek; 11-08-2018 at 07:42 AM.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Resizing Chart Data Range Size

    3 hours later and I still can't figure out a way to resize the Histdata2 range to be consistent with HistData1...
    Edit .............

    Absolute madness...

    Just figured it out...Nothing wrong with code...there were multiple charts on top of each other causing the issues...
    Last edited by sintek; 11-08-2018 at 03:18 PM.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,802

    Re: Resizing Chart Data Range Size

    Here are my debugging steps (after fixing the references to 2010 and later functions).

    1) Add a stop statement to the chart1() sub, just before setting references to histdata1 and histdata2, so I can step through as it sets those object variables. They appear to set correctly.
    2) Add a stop statement to histogram2() sub, just before assigning the sourcedata, and step through as it sets the new source data. The code runs, just fine, but no change is made to the chart in the spreadsheet.
    3) Double check the source data (debug.print chrt.seriescollection(1).formula). The output is the expect formula, and different from the formula in the formula bar of the chart. VBA says I changed the chart, but the chart says it did not change.
    4) Add a piece of text to the chart title a few lines down to see if I can change the chart title. Change executes, but no visible change in the spreadsheet. Begin to suspect that I am changing a chart, but not the chart I can see.
    5) In Immediate window, I enter debug.print activesheet.chartobjects.count. I see 2, but the count returns 12 -- it appears there are more charts than I can see.
    6) I click and drag what I see as chart 2 to somewhere else. There is another copy of chart 2 underneath. continue dragging charts out of the way until, at the bottom of the "stack", I find a chart that has been receiving the changes the code has been making.

    At this point, it appears to me that, somewhere in development, you made 10 extra copies of chart 2, right on top of each other. Your code is working just fine making changes to the "bottom" copy of chart 2, but you cannot see those changes because they are all underneath the 10 extra copies of chart 2. I don't know where the extra copies of chart 2 are coming from. Once those extra copies are out of the way, everything seems like it should work fine.

    Interestingly, the problem is not really about resizing the data range -- that part seems to be working fine. You just need to make the chart you are applying the changes to "visible".

    Is that all there is to this, or is there more?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Resizing Chart Data Range Size

    Hi MrShorty

    At this point, it appears to me that, somewhere in development, you made 10 extra copies of chart 2
    Yep, finally noticed that after a couple of hours...lol
    See previous post #4

    Nothing wrong with code...there were multiple charts on top of each other causing the issues...
    Problem arose when I was stepping through my earlier initial code which was adding charts ...

+ 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. Formula in text met sub and super font size resizing
    By lord anubis in forum Excel General
    Replies: 3
    Last Post: 03-24-2018, 07:10 AM
  2. Resizing Dimensions of Chart in Chart Sheet
    By Kabouterke in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-16-2018, 02:20 PM
  3. [SOLVED] Resizing and Moving a chart
    By sokeefe14 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2015, 10:11 AM
  4. Replies: 4
    Last Post: 08-25-2010, 02:59 PM
  5. Exporting Word Chart to Excel (Resizing Chart)
    By bg18461 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2008, 11:49 AM
  6. Resizing chart because of refreshing Chart Data through a query
    By jayb in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-10-2006, 11:25 AM
  7. [SOLVED] Resizing Userform to screen size
    By Al@n in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2006, 05:30 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