+ Reply to Thread
Results 1 to 5 of 5

Automation of Monthly Chart worngly populated if data less than 4 Months (Jan-Mar)

  1. #1
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Automation of Monthly Chart worngly populated if data less than 4 Months (Jan-Mar)

    Hi,

    I am writing a macro to create Line Makers chart. However, if the monthly data less than 4 months. e.g. Jan, Jan-Feb, Jan-Mar

    The chart SERIES will be wrongly populated to horizontal data rather than Vertical data (Accurate) .


    For details of code, please refer to attachment. For Jan-April & onwards, it working fine.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Faridwahidi; 10-28-2014 at 11:07 PM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Automation of Monthly Chart worngly populated if data less than 4 Months (Jan-Mar)

    the problem is here:
    Please Login or Register  to view this content.
    You just rely on Excel to setup series. And it works well for you if there is more rows than columns of data. Unfortunately sometimes there is more columns than rows in data range

    So instead of using whole data source, add series one by one.
    Best Regards,

    Kaper

  3. #3
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Automation of Monthly Chart worngly populated if data less than 4 Months (Jan-Mar)

    Hi kaper,

    I have tried this but wot working, Can you show me the code to do it one by one

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Automation of Monthly Chart worngly populated if data less than 4 Months (Jan-Mar)

    No, no, no, as I said - no SetSourceData.
    Try:
    Please Login or Register  to view this content.
    Note, that I left only rng_1 as 2 columns AB (label and value - wanted to avoid setting SeriesCollection(1).XValues = "=Chart!$A$2:$A$lastrow" ) - all other ranges are 1 column only (resp. C and D)
    and in main part we add not a whole datasorce, but series by series:
    Please Login or Register  to view this content.
    would be nice to have all variables declared, so add above declarations of 2 extra range type variables used
    Please Login or Register  to view this content.
    Shall work flawlessly now.

  5. #5
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Automation of Monthly Chart worngly populated if data less than 4 Months (Jan-Mar)

    Hi Kaper,

    Thanks a lot. It working fine, but a small problem when only January data available, X-Axis only display "1" rather than "Jan" for Jan-Feb & onward, it working fine


    One more problem Using add series collection, is the 2nd chart populated wrongly. e.g if I create 3 chart in the same worksheets, the 1st and 3rd chart working fine but the 2nd chart populated wrongly.
    Last edited by Faridwahidi; 10-29-2014 at 09:13 PM.

+ 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] Empty Data in Dynamically Populated Chart
    By Jonathan78 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 11-02-2013, 07:25 AM
  2. How to get monthly kWh usage when bill data spans months?
    By robertandrews in forum Excel General
    Replies: 3
    Last Post: 06-08-2013, 09:55 AM
  3. Hide chart data until populated
    By Munch5 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-26-2013, 04:19 PM
  4. [SOLVED] insert duplicate rows of data for monthly revenue recognition with sequential months
    By Dvyne in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-08-2013, 09:56 PM
  5. Chart Data Range Automation
    By mcmuney in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-09-2010, 09:52 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