+ Reply to Thread
Results 1 to 10 of 10

Macro to Auto Fill Dates in Column

  1. #1
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299

    Macro to Auto Fill Dates in Column

    I have a startdate F1 and an end date G1. Is there a macro that can list all dates by day within that range into column I7:down. A macro solution would be ideal.

    Thank you very much for your time and help.
    Last edited by erock24; 01-26-2009 at 12:03 PM.

  2. #2
    Registered User
    Join Date
    11-25-2008
    Location
    washington
    Posts
    24
    If you use this formula in I7 and drag down, it should work. This assumes I6 is blank

    =IF(I6="",G1-(G1-F1-1),IF(I6>=$G$1,"",I6+1))

  3. #3
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299
    Thank you for the reply. The formula works. However, I incorrectly stated my needs. Turns out I need to scratch the start date, end date stuff and proceed as described below:

    I need a macro that will identify the last cell in I and fill down the dates to the end of the year. For example, If the last cell in I were to be I188 and it = 6/30/2008, I need I189 to = 7/1/2008, I190 to = 7/2/2008, etc.

    Is there a macro that could do this?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    This worked for me.

    Note no error checking if you run it twice

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299
    That works perfect thank you. I added an error feature.
    Please Login or Register  to view this content.
    Last edited by erock24; 01-14-2009 at 03:23 PM.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  7. #7
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299
    How could I edit the macro to only fill to the last day of the month instead of the year?

    Thank you.

  8. #8
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299
    How do I make it always default to the last day of the month. Instead of having the "31" hard coded in?

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299

    Re: Macro to Auto Fill Dates in Column


  10. #10
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299

    Re: Macro to Auto Fill Dates in Column

    by jonmo1: http://www.mrexcel.com/forum/showthr...=1#post1816939

    Please Login or Register  to view this content.
    works perfect

+ 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