+ Reply to Thread
Results 1 to 5 of 5

Looking for Macro to Populate a Table Based on Date Ranges

  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    Montana
    MS-Off Ver
    Excel 2003
    Posts
    9

    Looking for Macro to Populate a Table Based on Date Ranges

    I am looking to take a data set and create a table that is summarized down according to a begining date and ending data. I have attached a file that shows what I am looking for.
    Thanks
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Looking for Macro to Populate a Table Based on Date Ranges

    Hello RTM1,

    I have added the macro below to the attached workbook. The macro runs after the end date has been entered.

    Macro Code
    Please Login or Register  to view this content.


    'Result' Worksheet Change Event Code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-08-2010
    Location
    Montana
    MS-Off Ver
    Excel 2003
    Posts
    9

    Smile Re: Looking for Macro to Populate a Table Based on Date Ranges

    Thanks for the help!!!!!

  4. #4
    Registered User
    Join Date
    03-08-2010
    Location
    Montana
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Looking for Macro to Populate a Table Based on Date Ranges

    I was testing the code and have found that if you have two records that match the end date it will only populate the first. Is there a way i can fix this so that all records on the end date are included? Thanks for your help

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Looking for Macro to Populate a Table Based on Date Ranges

    Hello RTM1,

    Here is the amended macro. I added a loop to check if EndDate is the last one. This macro will work correctly as long as all the dates are in ascending order. The attached workbook has the macro added.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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