how to create a cell that appends the current date time when ever the row is edited

fowzan

Board Regular
Joined
Aug 5, 2015
Messages
59
i have an inventory list. the prices keep updating. as of now there is no track to when a row (be it the cost price, sell price, vendor, packing, etc) was edited. i would like to create a new column "Updated On" which stores the date whenever a row is edited.

if a row is updated twice is it possible to store 2 dates like (15-11-15||10-10-14)
 
Give this event code a try...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Intersect(Target, Range("B:B,F:F,H:H")) Is Nothing Or Target.Count > 1 Then Exit Sub
  Application.EnableEvents = False
  If Len(Cells(Target.Row, "X").Value) Then
    Cells(Target.Row, "X").Value = Replace(Cells(Target.Row, "X").Value, ")", Format$(Date, "||dd-mm-yy)"))
  Else
    Cells(Target.Row, "X").Value = Format$(Date, "(dd-mm-yy)")
  End If
  Application.EnableEvents = True
End Sub
ok this is almost upto the point. but can you please add the new dates at the beginning of the cell value instead of at the end of the cell value
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
ok this is almost upto the point. but can you please add the new dates at the beginning of the cell value instead of at the end of the cell value
Give this a try...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Intersect(Target, Range("B:B,F:F,H:H")) Is Nothing Or Target.Count > 1 Then Exit Sub
  Application.EnableEvents = False
  If Len(Cells(Target.Row, "X").Value) Then
    Cells(Target.Row, "X").Value = Replace(Cells(Target.Row, "X").Value, "(", Format$(Date, "(dd-mm-yy||"))
  Else
    Cells(Target.Row, "X").Value = Format$(Date, "(dd-mm-yy)")
  End If
  Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,694
Messages
6,126,250
Members
449,305
Latest member
Dalyb2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top