+ Reply to Thread
Results 1 to 7 of 7

show current date and time when another cell change

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    show current date and time when another cell change

    hi,
    I want to show current date & time in column B when cells in column A is change.
    my formula is change all date when the last cell change

    thanks in advance
    herukuncahyono
    Attached Files Attached Files

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: show current date and time when another cell change

    try this:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns(1)) Is Nothing Then
        Application.EnableEvents = False
        Range("B" & Target.Row) = Now
        Application.EnableEvents = True
    End If
    End Sub
    Copy the code, right-click the sheet tab, click View Code and paste into the code window. Close the VB editor.

  3. #3
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    Re: show current date and time when another cell change

    hello teylyn,
    Thanks for code, one more question, if we want to change the format cell itself.
    like if cell A1 value change e.g type apple the value in cell A1 is apple mmm/dd/yy h:mm AM/PM


    thanks again
    herukuncahyono

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: show current date and time when another cell change

    try

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns(1)) Is Nothing Then
        Application.EnableEvents = False
        Range("B" & Target.Row) = target.value &" " & Now
        Application.EnableEvents = True
    End If
    End Sub
    If you just want the date, but not the time, exchange the Now in the code with Date

  5. #5
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    Re: show current date and time when another cell change

    Can the code works for all cell, as we are typing in all places in sheet, the format cell value is change ?

    thanks
    herukuncahyono

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: show current date and time when another cell change

    Your question was

    I want to show current date & time in column B when cells in column A is change.
    Can you please try to put yourself into the helper's shoes? If you post your real requirements from the start, a suitable solution could be provided first time round.

    If you change the goal posts with every follow up post, it does not get any easier.

    So.

    Make up your mind what you want. Then post a complete description of your requirements. Be as specific as possible. For example, you wanted a time stamp in column B if a value in column A changes. Where would you want the time stamp for "all places in sheet" ??


    Thanks

  7. #7
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    Re: show current date and time when another cell change

    hi teylyn,

    I use all the code and your suggestions.
    I thought of other things that can be done by the code.I am sorry I'll try in new thread.

    regards
    herukuncahyono

+ 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