+ Reply to Thread
Results 1 to 6 of 6

Insert rows for missing dates

  1. #1
    Registered User
    Join Date
    08-05-2009
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    4

    Smile Insert rows for missing dates

    Hello,

    I have a list of tasks to do spanning 200+ days. This data is imported into Excel from MS Project so will only contain dates with some activity against them (these are the start dates of the activities so will only be represented by one day). I would like to know how I can force Excel to insert rows for missing dates in a large spreadsheet so I can easily identify any days with no tasks assigned to them.

    Below is an example of what I CURRENTLY have;

    COLUMN A ** COLUMN B ** COLUMN C
    03/08/09 ** Mon ** Meet Customer
    03/08/09 ** Mon ** Contact suppliers
    04/08/09 ** Tue ** Obtain licence agreements
    06/08/09 ** Thur ** Contact HR anbout new starters
    10/08/09 ** Mon ** Meet new starters
    10/08/09 ** Mon ** Arrange directors meeting
    10/08/09 ** Mon ** Book offsite function room
    14/08/09 ** Fri ** Prepare budget reports


    Below is what I WOULD LIKE to have;

    COLUMN A ** COLUMN B ** COLUMN C
    03/08/09 ** Mon ** Meet Customer
    03/08/09 ** Mon ** Contact suppliers
    04/08/09 ** Tue ** Obtain licence agreements
    05/08/09 ** Wed **
    06/08/09 ** Thur ** Contact HR anbout new starters
    07/08/09 ** Fri **
    08/08/09 ** Sat **
    09/08/09 ** Sun **
    10/08/09 ** Mon ** Meet new starters
    10/08/09 ** Mon ** Arrange directors meeting
    10/08/09 ** Mon ** Book offsite function room
    11/08/09 ** Tue **
    12/08/09 ** Wed **
    13/08/09 ** Thur **
    14/08/09 ** Fri ** Prepare budget reports
    15/08/09 ** Sat **
    16/08/09 ** Sun **


    PLEASE NOTE: the astrix are only to separate the columns on this tread and are not present in the spreadsheet.

    I do not need any data inserted into column C,D,E,F etc but would like columns A and B populated (column B is a "nice have" - I can live without this being populated by the macro)

    Does anyone know of a function or suitable macro code that will do this?

    Your help will be most appreciated.

    Many thanks.
    Last edited by areeves1980; 08-05-2009 at 11:04 AM. Reason: Typo in the header

  2. #2
    Registered User
    Join Date
    08-05-2009
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Insert columns for missing dates

    Sorry - new to this and still finding my way around!
    Last edited by areeves1980; 08-05-2009 at 11:06 AM.

  3. #3
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Insert rows for missing dates

    Here is what I came up with:

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  4. #4
    Registered User
    Join Date
    08-05-2009
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    4

    Thumbs up Re: Insert rows for missing dates

    Excellent - thanks Dave. One slight oversight on my part - I failed to mention that there are column headers populating row 1. The code only works when I delete these......is there a way to amend the code to bypass the first row?

    Your help is very much appreciated.

    Andy

  5. #5
    Registered User
    Join Date
    08-05-2009
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Insert rows for missing dates

    One more amendment I would very much appreciate.......

    The extracts are likely to change to show the dd/mm/yy in column 4 and the weekday in column 5. What changes to the code do I need to make to reflect the change in location of these sets of data? I would want to continue showing blank cells for the rest of the columns for each new row inserted.

    Regards
    Andy

  6. #6
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Insert rows for missing dates

    Change "For i = 2..." to "For i = 3..." to account for the header row.
    The columns are assigned as the second argument in cell(). So it goes cell(row,column).
    To change the column from 1 to 4 you'd go: cells(row,4) instead of cells(row,1). Make sense?

+ 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