Capturing The Date Of When Data Is Inputted

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When data is inputted into a cell I would like to capture the date of when
that occurred. How could I do that and then utilze that date in a formula
later on?

Any help would be appreciated...
 
This event code will place the date in the adjacent cell in column B when you
enter data in column A in the range A1:A20

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
If Intersect(Range(Target(1).Address), _
Range("A1:A20")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target.Offset(0, 1).Value = Now()
ws_exit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste the code into that sheet module.

Range can be one cell like "A1" or an entire column like "A:A" or a fixed
range "A1:A20" as I have written above.


Gord Dibben MS Excel MVP
 
Back
Top