Tip: andere talen zijn Google-Vertaald. Je kunt het English versie van deze link.
Log in
x
or
x
x
Registreren
x

or

Hoe datum en tijd automatisch opnemen wanneer de cel verandert?

Het is gemakkelijk voor ons om statische datum en tijd handmatig in te voegen of een dynamische datum in te voegen die verandert met de systeemtijd met een formule. Als u de datum en tijd automatisch wilt opnemen wanneer u waarden wijzigt of invoert, kan dit probleem enigszins anders zijn om mee om te gaan. Maar in dit artikel kunt u deze taak oplossen met de volgende stappen.

Registreer datum en tijd automatisch wanneer de cel verandert met VBA-code

Tabblad Office Schakel bewerken en browsen met tabbladen in Office in en maak uw werk veel eenvoudiger ...
Kutools voor Excel - De beste Office-productiviteitstool lost de meeste van uw Excel-problemen op
  • Alles hergebruiken: Voeg de meest gebruikte of complexe formules, grafieken en al het andere toe aan uw favorieten en hergebruik ze snel in de toekomst.
  • Meer dan 20-tekstfuncties: Nummer uit tekststring halen; Een deel van de tekst extraheren of verwijderen; Nummers en valuta's omzetten in Engelse woorden ...
  • Tools samenvoegen: Meerdere werkmappen en bladen in één; Meerdere cellen / rijen / kolommen samenvoegen zonder gegevens te verliezen; Dubbele rijen en som samenvoegen ...
  • Split gereedschap: Gegevens splitsen in meerdere bladen op basis van waarde; Eén werkmap naar meerdere Excel-, PDF- of CSV-bestanden; Eén kolom naar meerdere kolommen ...
  • Plakken overslaan Verborgen / gefilterde rijen; Tel en som op achtergrondkleur; Maak een verzendlijst en Verzend e-mails op waarde van Cell...
  • Super filter: Maak geavanceerde filterschema's en pas deze toe op alle bladen; Soort per week, dag, frequentie en meer; filters door vetgedrukt, formules, commentaar ...
  • Meer dan 300 krachtige functies; Werkt met Office 2007-2019 en 365; Ondersteunt alle talen; Eenvoudig inzetbaar in bedrijf; Volledige functionaliteit 60-daagse gratis proefversie.

pijl blauwe rechterbel Registreer datum en tijd automatisch wanneer de cel verandert met VBA-code


Ik heb bijvoorbeeld een reeks waarden, en nu, als ik in kolom B nieuwe waarden wijzig of typt, wil ik dat er automatisch de huidige datum en tijd in kolom C worden vastgelegd zoals in het volgende screenshot:

doc update-time-value-veranderingen-1

Je kunt deze taak afmaken met de volgende VBA-code. Doe alsjeblieft als volgt:

1. Houd de toets ingedrukt ALT + F11 toetsen om de te openen Microsoft Visual Basic for Applications-venster.

2. Kies vervolgens uw gebruikt werkblad aan de linkerkant Projectverkenner, dubbelklik erop om het te openen module, en kopieer en plak vervolgens de VBA-code in de lege module:

VBA-code: noteer datum en tijd automatisch wanneer de cel verandert

Private Sub Worksheet_Change(ByVal Target As Range)
'Update 20140722
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("B:B"), Target)
xOffsetColumn = 1
If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
        If Not VBA.IsEmpty(Rng.Value) Then
            Rng.Offset(0, xOffsetColumn).Value = Now
            Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
        Else
            Rng.Offset(0, xOffsetColumn).ClearContents
        End If
    Next
    Application.EnableEvents = True
End If
End Sub

doc update-time-value-veranderingen-1

3. Sla deze code vervolgens op en sluit deze om naar het werkblad terug te keren; als u nu de celwaarde wijzigt of nieuwe gegevens typt in kolom B, worden de datum en tijd automatisch geregistreerd in kolom C.

Opmerkingen:

1. In de bovenstaande code kunt u de "B: B"Naar een andere kolom waarvan u de celwaarden in dit script wilt wijzigen: Set WorkRng = Intersect (Application.ActiveSheet.Range ("B: B"), Target).

2. Hiermee xOffsetColumn = 1 script, kunt u de datum en tijd invoegen en bijwerken naar de eerste kolom naast de kolom met veranderende waarden. U kunt het nummer 1 wijzigen in andere nummers, zoals 2,3,4,5 ... dat betekent dat de datum wordt ingevoegd als tweede, derde, vierde of vijfde kolom naast uw kolom met gewijzigde waarden.

3. Wanneer u een waarde in de gewijzigde kolom verwijdert, worden ook de datum en tijd verwijderd.


Kutools voor Excel - De beste Office-productiviteitstool Verhoog uw productiviteit met 80%

  • visfuik: Snel invoegen complexe formules, grafieken en alles wat je eerder hebt gebruikt; Coderen van cellen met wachtwoord; Maak een mailinglijst en stuur e-mails ...
  • Super Formula Bar (bewerk eenvoudig meerdere regels tekst en formule); Lay-out lezen (gemakkelijk grote aantallen cellen lezen en bewerken); Plakken op gefilterd bereik...
  • Cellen / rijen / kolommen samenvoegen zonder gegevens te verliezen; Inhoud gesplitste cellen; Combineer dubbele rijen / kolommen... voorkomen dubbele cellen; Ranges vergelijken...
  • Selecteer Dupliceren of Uniek rijen; Selecteer Lege rijen (alle cellen zijn leeg); Super Find en Fuzzy Find in veel werkboeken; Willekeurig selecteren ...
  • Exacte kopie Meerdere cellen zonder formule-referentie te wijzigen; Automatisch referenties maken naar meerdere vellen; Voeg kogels toe, Selectievakjes en meer ...
  • extract Text, Tekst toevoegen, verwijderen op positie, Verwijder de spatie; Subtotalen voor paging maken en afdrukken; Converteren tussen cellen Inhoud en opmerkingen...
  • Super filter (bewaar en pas filterschema's toe op andere bladen); Geavanceerde sortering per maand / week / dag, frequentie en meer; Speciaal filter door vet, cursief ...
  • Combineer werkmappen en werkbladen; Tabellen samenvoegen op basis van sleutelkolommen; Gegevens splitsen in meerdere bladen; Batch Converteer xls, xlsx en PDF...
  • Meer dan 300 krachtige functies. Ondersteunt Office / Excel 2007-2019 en 365. Ondersteunt alle talen. Eenvoudig te implementeren in uw onderneming of organisatie. Volledige functionaliteit 60-daagse gratis proefversie.
kte-tab 201905

Tabblad Office Brengt interface met tabbladen naar Office en maakt uw werk veel eenvoudiger

  • Bewerken en lezen met tabbladen inschakelen in Word, Excel, PowerPoint, Publisher, Access, Visio en Project.
  • Open en maak meerdere documenten in nieuwe tabbladen van hetzelfde venster, in plaats van in nieuwe vensters.
  • Verhoogt uw productiviteit met 50% en verlaagt dagelijks honderden muisklikken voor u!
Officetab onderaan
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Ian Cunningham · 22 days ago
    The code in "VBA code: Record date and time automatically when cell changes" above works well in my worksheet where I manually enter data in a cell. However, I have a "summary" worksheet in which cells automatically update their value based upon the values of cells on other worksheets in the same workbook, e.g. The formula in my cell B6 on my 'summary' worksheet might be ='Example'!F3. When the value in 'Example!F3 changes the summary sheet cell B6 automatically updates to a new value. I am trying to show a timestamp on the summary sheet when ever changes occur to save me having to search through numerous linked worksheet for changes. With the present VBA code nothing happens when the value on my 'summary' sheet updates from the data on the linked worksheet cells. Can you help with this please?
  • To post as a guest, your comment is unpublished.
    Hannes · 7 months ago
    Would it be possible to have the timestamp appear 5 rows down? Would need it in an specific cell and not the entire column.
    Column range is easy to change to specific cell but i don´t know how to get the timestamp in an specific cell :(
    Please help!
  • To post as a guest, your comment is unpublished.
    Hannes · 7 months ago
    Would it be possible to change on what row the timestamp is showed? I would like to have the timestamp 5 rows down.
    Tried xOffsetRows = 5 but that did not word, maybe that command does not exist :)
    Please help!
  • To post as a guest, your comment is unpublished.
    Cody · 7 months ago
    what about if i need to have column I, J, and K all trigger a date into column L? I have tried posting script 3 times, and changing the name, and column offset, but it never runs the second and third script.
  • To post as a guest, your comment is unpublished.
    Cody Baird · 7 months ago
    also, i had to change the first line of code to be different for each copy/paste.
    example
    Private Sub Worksheet_Change (ByVal Target As Range)

    the next is

    Private Sub Worksheet_Change1 (ByVal Target As Range)


    by doing so i eliminate an error Compile Error: Ambiguous name detected: Worksheet_Change.

    if i duplicate this name it causes this error, so i changed them by adding a 1, 2, 3 etc..
  • To post as a guest, your comment is unpublished.
    Cody · 7 months ago
    I am attempting to make this reference multiple columns and reflect the date of any change in these columns back to one column. example, if i change anything in I,J,or K I want the date updated to current in L. i have tried to copy this VB code 3 times, changing the target, and column application to be I:I and 3 J:J and 2, K:K and 1. only K:K will work to change L. thoughts?
  • To post as a guest, your comment is unpublished.
    tom Vincent · 8 months ago
    I received Run-Time Error '1004'


    This is the VBA on my Excel:


    Private Sub Worksheet_Change(ByVal Target As Range)
    'Update 20140722
    Dim WorkRng As Range
    Dim Rng As Range
    Dim xOffsetColumn As Integer
    Set WorkRng = Intersect(Application.ActiveSheet.Range("I:I"), Target)
    xOffsetColumn = -3
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xOffsetColumn).Value = Now
    Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
    Else
    Rng.Offset(0, xOffsetColumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If
    Set WorkRng = Intersect(Application.ActiveSheet.Range("I:I"), Target)
    xOffsetColumn = -5
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xOffsetColumn).Value = Now
    Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mmm-yyyy"
    Else
    Rng.Offset(0, xOffsetColumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If
    Dim xRg As Range
    On Error Resume Next
    Set xRg = Intersect(Range("A:O"), Target)
    If xRg Is Nothing Then Exit Sub
    Target.Worksheet.Unprotect Password:="123"
    If xRg.Value <> mStr Then xRg.Locked = True
    Target.Worksheet.Protect Password:="123"
    End Sub


    Thank You
  • To post as a guest, your comment is unpublished.
    Vincent · 8 months ago
    I receive Run-time error '1004'

    This is the VBA on my excel:


    Private Sub Worksheet_Change(ByVal Target As Range)
    'Update 20140722
    Dim WorkRng As Range
    Dim Rng As Range
    Dim xOffsetColumn As Integer
    Set WorkRng = Intersect(Application.ActiveSheet.Range("I:I"), Target)
    xOffsetColumn = -3
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xOffsetColumn).Value = Now
    Rng.Offset(0, xOffsetColumn).NumberFormat = "hh:mm:ss"
    Else
    Rng.Offset(0, xOffsetColumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If
    Set WorkRng = Intersect(Application.ActiveSheet.Range("I:I"), Target)
    xOffsetColumn = -5
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xOffsetColumn).Value = Now
    Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mmm-yyyy"
    Else
    Rng.Offset(0, xOffsetColumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If
    Dim xRg As Range
    On Error Resume Next
    Set xRg = Intersect(Range("A:O"), Target)
    If xRg Is Nothing Then Exit Sub
    Target.Worksheet.Unprotect Password:="123"
    If xRg.Value <> mStr Then xRg.Locked = True
    Target.Worksheet.Protect Password:="123"
    End Sub



    Thanks
  • To post as a guest, your comment is unpublished.
    Hadi Wibowo · 9 months ago
    Kalau munculnya waktu minta di bawah bagaimana?
  • To post as a guest, your comment is unpublished.
    Chris · 9 months ago
    This is exactly what I needed. Since I needed a timestamp in column F to reflect any changes in columns A, B, C, D, or E in a row, I duplicated the code that many times and redefined the range to point to each of the columns within the different iterations of the code.

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Update 20140722
    Dim WorkRng As Range
    Dim Rng As Range
    Dim xOffsetColumn As Integer

    Set WorkRng = Intersect(Application.ActiveSheet.Range("A:A"), Target)
    xOffsetColumn = 5
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xOffsetColumn).Value = Now
    Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
    Else
    Rng.Offset(0, xOffsetColumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If

    Set WorkRng = Intersect(Application.ActiveSheet.Range("B:B"), Target)
    xOffsetColumn = 4
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xOffsetColumn).Value = Now
    Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
    Else
    Rng.Offset(0, xOffsetColumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If


    etc...
    • To post as a guest, your comment is unpublished.
      Tom · 1 months ago
      Thanks Chris, you saved me from a big headache!
    • To post as a guest, your comment is unpublished.
      MIke · 9 months ago
      Hi Chris, I see you posted the exact answer to my previous question already. I just had to expand the reading area. My bad. Thank you so much for your post. This has been so helpful.
    • To post as a guest, your comment is unpublished.
      Mike · 9 months ago
      Hi Chris, Can you let me know what part of the code I should copy and also where to paste it? I'm trying the same but am getting error codes. Preferably I would like to get a timestamp in Column F to reflect a change in Column A, and a timestamp in Column G to reflect a change in Column B. But one timestamp for a change in column A, B, C, D, or E like you did would already be great. Many thanks for your help.
  • To post as a guest, your comment is unpublished.
    Bonnie · 9 months ago
    Also, I have to say: Your instructions are THE BEST, so simple but effective and straight forward!!!

    by simply adding Rng.Offset(0, yOffsetColumn).Value = Environ$("UserName")

    above Else in the next column I am capturing the Windows Username as well, I didn't need a full Audit Trail and wanted the Change info WITH the data, this is perfect.


    Thank you so much!
  • To post as a guest, your comment is unpublished.
    Bonnie · 9 months ago
    I was wondering how would you modify the code to fill in the date only if you wanted it to populate for a given value. Say I only want the date to populate when I select "Closed" for a value for the target range?
  • To post as a guest, your comment is unpublished.
    Amr Soliman · 10 months ago
    what can i do if i need to add another range in same sheet
    when i fill in column A reflect date & time in column B and when filling in column C reflect date & time in column D
    and when i clear the content of column A or C it clear B or D too

    please help me in this
    • To post as a guest, your comment is unpublished.
      Anto. · 9 months ago
      Me too expecting for the same pl help
  • To post as a guest, your comment is unpublished.
    Amr Soliman · 10 months ago
    What if i need to another range in same sheet?
    When i fill in column A reflect date&time in column B and when i fill in column C reflect date&time in column D
    and when i clear of any column A or C it clear B & D
  • To post as a guest, your comment is unpublished.
    J Hayes · 11 months ago
    This was very helpful. Thank you! :-)
  • To post as a guest, your comment is unpublished.
    shiva · 1 years ago
    how to make this work, if there is updated in E:E range as well?
  • To post as a guest, your comment is unpublished.
    Asela · 1 years ago
    Here is the macro to update Modified date to column F on each row.

    ------------------------------------------------

    'This Macro has been written to update Last modified date/time on each A2:D43415
    'Last Modified date applied to column F.

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rInt As Range
    Dim rCell As Range
    Dim tCell As Range
    Dim tColInt As Integer

    tColInt = 6 'Column Index, Example: A=1, B=2, ...... ,Z=26


    Set rInt = Intersect(Target, Range("A2:D43415")) 'Change cell range
    If Not rInt Is Nothing Then
    For Each rCell In rInt
    Set tCell = Cells(rCell.Cells.Row, tColInt)
    If IsEmpty(tCell) Or Not IsEmpty(tCell) Then
    tCell = Now
    tCell.NumberFormat = "dd/mm/yyyy h:mm:ss AM/PM" 'Custom Format
    End If
    Next
    End If
    End Sub
  • To post as a guest, your comment is unpublished.
    Juttskt · 1 years ago
    example
    Set WorkRng = Intersect(Application.ActiveSheet.Range("E:E,F:F,G:G,H:H"), Target)
    xOffsetColumn = 8
    i want any entry change in column E, F, G, H then date can stamp column M

    please help me in this
  • To post as a guest, your comment is unpublished.
    I wayan · 1 years ago
    Hi all, the code is working fine but i does not work when the worksheet is protected. although I have unprotected the column the certain column for the timestamp is. i am attaching the error message pop up. please help.

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Update 20140722
    Dim WorkRng As Range
    Dim Rng As Range
    Dim xOffsetColumn As Integer
    Set WorkRng = Intersect(Application.ActiveSheet.Range("B:B"), Target)
    xOffsetColumn = 1
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xOffsetColumn).Value = Now
    Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
    Else
    Rng.Offset(0, xOffsetColumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If
    End Sub
  • To post as a guest, your comment is unpublished.
    I Wayan Murdikayasa · 1 years ago
    Hi all,

    i use the code given and it works perfectly. but it does not working whenever the sheet is locked, although, i already unlocked the column form the time stamp is. can you help? thank you in advance.
  • To post as a guest, your comment is unpublished.
    Ali · 1 years ago
    Plz Reply


    Every thing is perfect ...every time i save the script but when i close the application and reopen it the script does not work and i need to write/copy it again.
    thanx
  • To post as a guest, your comment is unpublished.
    Ali · 1 years ago
    Every thing is perfect ...every time i save the script but when i close the application and reopen it the script does not work and i need to write/copy it again.
    thanx
  • To post as a guest, your comment is unpublished.
    Deividas · 1 years ago
    Hello,


    Is it possible to implement this code with the data refresh. Because when i refresh the data it always puts the now stamp, however when the data is changed manually it does it okay and only records when manually changed correctly so all the times are then different, but when refreshed it might create new rows and therefore it puts all the current timestamps.
  • To post as a guest, your comment is unpublished.
    Terri Blackwell · 1 years ago
    How do I get this code to put the date stamp in the column to the left? I tried -1 and it didn't work. Also, it doesn't seem to recognize data filled in by a formula. Can I do that? I need this for twelve different columns in one Summary sheet that gathers data from six departmental sheets. Any help would be greatly appreciated.
  • To post as a guest, your comment is unpublished.
    sri laqshya · 1 years ago
    Hi, Can anyone one suggest a code for when I input number in column A and Column B and in Column C I kept a formula like Column A + Column B. Now I need a vba code that can give time and date in Column D whenever Column C changes not when inserting numbers in Column A and B.
  • To post as a guest, your comment is unpublished.
    Petras · 1 years ago
    Hello,
    How to define exact column for timestamp instead offset ?
  • To post as a guest, your comment is unpublished.
    Gábor · 1 years ago
    Hi,
    the code runs perfectly, this is what I was searching for. One little update / help needed:
    I have the data in column B, the time is in column AA, and have another data in column A. It would be great if you could modify the code, so it will run only if the values in B and A are matching.

    Thanks in advance.
    • To post as a guest, your comment is unpublished.
      Gábor · 1 years ago
      I have figured out. It's already down
      • To post as a guest, your comment is unpublished.
        Deividas · 1 years ago
        Hello, could you share how you done it?
        • To post as a guest, your comment is unpublished.
          Gábor · 1 years ago
          Hello there,
          Update the original code with that.
          In the meanwhile I have put another IF statement update before the code " If Rng.Offset(0, 1).Value = 0 Then ", because whenever you delete an upper row, it will cause cell value change, an will stamp the time again.

          If Rng.Offset(0, 1).Value = 0 Then
          If Not VBA.IsEmpty(Rng.Value) And Rng.Offset(0, -1).Value = Rng.Offset(0, 0).Value Then

          Hope it helped to you. :)
  • To post as a guest, your comment is unpublished.
    Gábor · 1 years ago
    Hi,
    the code works perfectly, this is what I was searching for. Thanks.
    One more little help / update about the code. I have the data in column B, the date+time is in AA, and another data in column A. Can you please help to modify the code, so it will run only if value in B and A is the same.

    Thanks in advance
  • To post as a guest, your comment is unpublished.
    Rodney · 1 years ago
    I am having trouble getting the code to do what I want and think I am missing a step.



    I have a spreadsheet that I would like TODAY returned into Column N whenever an "X" is placed in either Column O or P, and return to blank if that "X" is deleted. What am I missing in code that will allow me to have that happen?
  • To post as a guest, your comment is unpublished.
    Hari · 1 years ago
    Tried code. Worked perfect in normal cases. But i need it little more advanced.
    I need the time & date populated in column F; keeping the columns from A to E uneditable.
    Can you help?
  • To post as a guest, your comment is unpublished.
    Jens · 2 years ago
    What if I wanted the script to look for changes to the row and then update a specific cell? What would that look like?
  • To post as a guest, your comment is unpublished.
    jazz · 2 years ago
    Worked great! Thanks!!
  • To post as a guest, your comment is unpublished.
    Morten · 2 years ago
    Thanks a bunch for the code, it works perfectly!
  • To post as a guest, your comment is unpublished.
    ankit · 2 years ago
    this code changes all previous time stamps when i modify, say Nth cell, all (N-1) cell get their time changed
    • To post as a guest, your comment is unpublished.
      Excel Rookie · 1 years ago
      I am having the same issue. I want to record the date that a specific cell was changed, For example, if B2 is changed then I want to record the date and time that happened in C2. With this code, if I change B8 or B26 it changes the time stamp in all of the C cells if the row has a value in B. (Therefore, overwriting the date that was in C2 and putting the new date in C2, C8 and C26.)
  • To post as a guest, your comment is unpublished.
    Eric · 2 years ago
    This macro/VBA works perfectly when I change the cell directly. However when I change the cell via a form, then the macro/VBA does not run and no date is added. Do you know the solution for this?
    • To post as a guest, your comment is unpublished.
      Michal · 1 years ago
      HI,

      Did you manage to resolve this? I have the same issue and it would be big help if you could share the code.
  • To post as a guest, your comment is unpublished.
    gokul · 2 years ago
    in my worksheet, i need the date and time in first column...how to do this?what are the changes i need to do with vba...
    • To post as a guest, your comment is unpublished.
      Jens · 2 years ago
      I have the same issue. Or, wel. Look for changes to the row and update a specific cell. Any leads on a solution?
  • To post as a guest, your comment is unpublished.
    your name · 2 years ago
    Thank you for your help :-)
  • To post as a guest, your comment is unpublished.
    Keith Davis · 2 years ago
    Thank you so much for the code! Exactly what I was looking for!!
  • To post as a guest, your comment is unpublished.
    Preeti · 2 years ago
    When i am record in macro a vloocup formula so how can i do that date automatically changed to 1 day up

    Like its 21/07/2017
    then next day its changed to 22/07/2017

    Automatically
    pls share if is there any vba code.
    • To post as a guest, your comment is unpublished.
      amarj · 2 years ago
      replace this line
      Rng.Offset(0, xOffsetColumn).Value = Now

      to
      Rng.Offset(0, xOffsetColumn).Value = Now+1
  • To post as a guest, your comment is unpublished.
    Lisa · 2 years ago
    this code will show date on click it appears, is it possible to show date only when content in cell is changed, if only clicked and nothing changed, then date does not show or previously entered date stays?
  • To post as a guest, your comment is unpublished.
    Nick · 2 years ago
    I found this code elsewhere and modified it for my use. If done properly, you do not need to worry about entering a function in a cell or the file changing the dates to that day's date every time it is opened.

    - open Excel
    - press "Alt+F11"
    - Double-click on the worksheet that you want to apply the change to (listed on the left)
    - copy/paste the code below
    - adjust the Range(_:_) input to correspond to the column you will update
    - adjust the Offset(0,_) input to correspond to the column where you would like the date displayed (in the version below I am making updates to column D and I want the date displayed in column F, hence the input entry of "2" for 2 columns over from column D)
    - hit save
    - repeat steps above if there are other worksheets in your workbook that need the same code
    - you may have to change the number format of the column displaying the date to "General" and increase the column's width if it is displaying "####" after you make an updated entry

    Copy/Paste Code below:
    ____________________________________________________________


    Private Sub Worksheet_Change(ByVal Target As Range)

    If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
    Target.Offset(0, 2) = Date

    End Sub

    ____________________________________________________________
    Good luck...
  • To post as a guest, your comment is unpublished.
    Quincey · 2 years ago
    Hi,

    I need some VBA coding help.

    I am creating a spread sheet with cases which will be assigned to people and have case status.

    The assignee's will be in Col H and I need a date stamp in Col I when the cell in Col H get updated or changed with a name.
    Similarly I will have case status in Col J and will need a date stamp in Col K when a status get inputted or changed.

    also when there is non assignee name or status I need the date stamp in Col I and K to be blank.

    Any help would be appreciated.

    Thanks
  • To post as a guest, your comment is unpublished.
    Dinesh Dumbre · 2 years ago
    How can i configure to read the A:A column and give time stamp in B:B only when a 14 digit number is entered in it ?
  • To post as a guest, your comment is unpublished.
    mike · 2 years ago
    Hi ,

    Thank you kindly for this as it is great for WB auditability.

    Is there a way of altering this to have the date/time be logged somewhere on the WB whenever a comment is added or modified? I know this is a general question, but I am not sure if it's possible (unfortuantely for MS 2010, the .comment property does not hold a date property to identify when it was entered.

    Mike
  • To post as a guest, your comment is unpublished.
    Jason · 2 years ago
    How do I get the time stamp to record in a specific cell, instead of the cell next to the one that was changed. I am attempting to have a row of cells time stamped when a change occurs in any of those cells, I would like the time stamp to record in one specific cell...can anyone help with this? Thank you!
  • To post as a guest, your comment is unpublished.
    Josh · 2 years ago
    How do I change it so only the adjacent cell date changes?
  • To post as a guest, your comment is unpublished.
    Linda · 2 years ago
    I can change the range to be ("A:Q") but I need the date and time to go in "S" if the data in any A-Q cell is changed/removed. I'm VBA challenged. Any help is greatly appreciated!
    • To post as a guest, your comment is unpublished.
      Jason · 2 years ago
      Sorry, I just posted a question and I need the answer to this...I must have missed this comment...hopefully someone can help!
  • To post as a guest, your comment is unpublished.
    Carlie · 2 years ago
    Is there a way to time stamp based on a specific change? For example, I have a spreadsheet with a column of drop-down options including being blank, 'Ok', and 'Act'. When the task is completed, the drop down is manually used to select 'Ok'. I'd like the date stamp to be tied to when 'Ok' is selected, but not when 'Act' is selected. The 'Act' option in the drop down is used when a task is past due, but I'm really just trying to track when an item is completed.

    Is there a way to accomplish this with the above code? Thanks!
  • To post as a guest, your comment is unpublished.
    Alysha · 3 years ago
    Is it possible to do this for historical data? If I made changes to a cell yesterday or a month ago, can I use a form of this code to retrieve those dates?
  • To post as a guest, your comment is unpublished.
    Wend Elin · 3 years ago
    I am attempting to run the above code; however, the cell who's change I want to record is linked to a checkbox and is therefore either "TRUE" or "FALSE". For some reason, the code will not work when the cell changes. However, if I insert say "yes" manually, the code works fine. Any workaround for this issue that you are aware of? Thank you!