Show date cell modified

M

manxman

We have a table with material prices, and would like to see at a glance, in
the next cell, when a price was last modified.
 
G

Gord Dibben

manx

Right-click on the sheet tab and "View Code".

Copy/paste the following event code to that module.

As you enter/edit prices in column A, the data/time will be stamped in column B.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value <> "" Then
Excel.Range("B" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 
G

Gord Dibben

Typo.......should be date/time will be stamped


Gord

manx

Right-click on the sheet tab and "View Code".

Copy/paste the following event code to that module.

As you enter/edit prices in column A, the data/time will be stamped in column B.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value <> "" Then
Excel.Range("B" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

Gord Dibben MS Excel MVP
 
Top