+ Reply to Thread
Results 1 to 10 of 10

Date to column once a day

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2016
    Posts
    43

    Date to column once a day

    I am new to VBA and would like to know what the code would look like if I want the date to appear one time in a column per day. I would like to use it to track daily entries so I would need yesterday's date to stay when I add data the next day. I would also like the date (column A) to show the date only once regardless of how many updates are placed in column B,C,D... and I would like the date update to trigger by new data being entered/moved into column B? This question has probably been asked before, I tried to search for it prior to asking for help and I am pretty sure there are VBA masters that help people in this forum that can help with easy requests like this.

    Thank you in advance for your help.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date to column once a day

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2016
    Posts
    43

    Re: Date to column once a day

    Thank you for your reply, please let me know if this makes sense.
    Attached Files Attached Files

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date to column once a day

    Hi,

    If you just want to hide the repeated dates then use this conditional format in A2 and apply it to all cells in column A. Set the format of the font colour to white,(or whatever the background colour of the cells)

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Better still use a Pivot table - see attached
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-28-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2016
    Posts
    43

    Re: Date to column once a day

    Sorry I didn't explain very well. I am looking for the date to auto populate when data is added in column B and like the example I only want to see the date once per daily entry (like the pivot).

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date to column once a day

    You'll need a sheet change macro for this.

    Please Login or Register  to view this content.
    It assumes all previous dates are earlier than today's date.

  7. #7
    Registered User
    Join Date
    01-28-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2016
    Posts
    43

    Re: Date to column once a day

    If I load this macro into a new module will column B automatically populate with today's date? Again sorry I am new at VBA.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date to column once a day

    The macro is a Sheet level macro, not one that belongs in a Module. i.e one that reacts to a sheet change event, in this case a change in column B.

    Bsed on the example you gave it's Column A (not B) that will populate with today's date IF and only If it doesn't already exist in an earlier columns A cell. This will happen once you add a new value in column B

    In VBA double click the Sheet in question in the Project Explorer Window, select Worksheet from the left hand drop down above the code area and select Sheet Change from te right hand drop down.

  9. #9
    Registered User
    Join Date
    01-28-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2016
    Posts
    43

    Re: Date to column once a day

    This is exactly what I wanted. Thank you for your patience and explanation.

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date to column once a day

    Quote Originally Posted by hp801 View Post
    This is exactly what I wanted. Thank you for your patience and explanation.
    Gals to have helped and thanks for the rep.

+ 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. Replies: 4
    Last Post: 04-26-2018, 11:35 AM
  2. Replies: 5
    Last Post: 10-13-2017, 05:09 PM
  3. Replies: 3
    Last Post: 04-08-2016, 09:11 AM
  4. [SOLVED] getting total from column if todays date is equal to or greater than date column
    By peterjb44 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-11-2013, 07:43 PM
  5. [SOLVED] Auto fill a column based on date and color a column if past that date
    By thegunder in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-29-2013, 03:06 PM
  6. Vba to subtract current date from date in column G and put static diff in column H
    By jtyoder in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-31-2013, 02:55 PM
  7. If hire date (column D) is greater than revision date (column F) then delete row
    By bruinsrme in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2013, 07:25 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