ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to record date on sheet data is entered in a cell ? (https://www.excelbanter.com/excel-programming/371358-macro-record-date-sheet-data-entered-cell.html)

Jim scrivener

Macro to record date on sheet data is entered in a cell ?
 
I need a macro to auto insert in an adjacent call the date data is entered in
a cell.
The following does not work because "Now" changes every day:
=IF(CK3<"",NOW(),"")

Gary''s Student

Macro to record date on sheet data is entered in a cell ?
 
This tiny macro looks for changes in column A and puts the date in the
corresponding row in column B:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
Target.Offset(0, 1) = Now
End Sub

This should be copied to worksheet code, not a standard module.
--
Gary's Student


"Jim scrivener" wrote:

I need a macro to auto insert in an adjacent call the date data is entered in
a cell.
The following does not work because "Now" changes every day:
=IF(CK3<"",NOW(),"")


Jim Thomlinson

Macro to record date on sheet data is entered in a cell ?
 
Here is some code that should do what you want... Paste this into the sheet
(right click the sheet tab and select view code). This code works on Cell CK3
but you can change it to whatever range you want...

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("CK3")) Is Nothing Then _
Target.Offset(0, 1).Value = Now()
End Sub

--
HTH...

Jim Thomlinson


"Jim scrivener" wrote:

I need a macro to auto insert in an adjacent call the date data is entered in
a cell.
The following does not work because "Now" changes every day:
=IF(CK3<"",NOW(),"")



All times are GMT +1. The time now is 09:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com