+ Reply to Thread
Results 1 to 6 of 6

Auto-fill the current date if the previous row was empty

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Question Auto-fill the current date if the previous row was empty

    Hello,

    I have a spreadsheet sorted by dates. Everyday, I enter new data into it. After each day, I leave one row empty before starting the next day. Example:

    Please Login or Register  to view this content.
    So I want excel to always fill in the current date whenever I enter data after one blank row, but obviously the dates shall stay the same - not be updated to the current date whenever I open excel. I am using Excel 2007 and while non vba ideas are preferred, vba is not a problem either!

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Auto-fill the current date if the previous row was empty

    Try the small worksheet event macro:


    Please Login or Register  to view this content.


    Because it is worksheet code, it is very easy to install and automatic to use:

    1. right-click the tab name near the bottom of the Excel window
    2. select View Code - this brings up a VBE window
    3. paste the stuff in and close the VBE window

    If you have any concerns, first try it on a trial worksheet.

    If you save the workbook, the macro will be saved with it.


    To remove the macro:

    1. bring up the VBE windows as above
    2. clear the code out
    3. close the VBE window

    To learn more about macros in general, see:

    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    To learn more about Event Macros (worksheet code), see:

    http://www.mvps.org/dmcritchie/excel/event.htm
    Gary's Student

  3. #3
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: Auto-fill the current date if the previous row was empty

    Great, thank you very much!

    One little thing though, I realised that I was inaccurate in my description of my problem.
    Actually, the row is not entirely empty, coloumn "I" is populated either with a number or with a sign that basically states that it is empty.
    How could I modify your ".EntireRow" to reflect that situation?

    Thank you very, very much for your fast response!

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Auto-fill the current date if the previous row was empty

    Remove the first macro and insert:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: Auto-fill the current date if the previous row was empty

    Great, that works, thank you very much!

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Auto-fill the current date if the previous row was empty

    @ lesoies

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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