Place the following event macro in the worksheet code area:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim d5 As Range, t As Range
Set d5 = Range("D5")
Set t = Target
If Intersect(t, d5) Is Nothing Then Exit Sub
If Not IsEmpty(Range("A5")) Then Exit Sub
Application.EnableEvents = False
Range("A5").Value = Date
Range("B5").Value = Time
Application.EnableEvents = True
End Sub
Because it is worksheet code, it is very easy to install and use:
1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
To remove the macro:
1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
--
Gary''s Student - gsnu200909
"Daniel" wrote:
I want to setup a date column that each cell in the date column reflects the
date that another column in the same row was filled in.
Example: I enter a numerical value in cell D5 that is greater than 0. I want
A5 to record the date that I entered that data.
Also I would like to do the same thing with time in cell B5. How could I do
this?
Thanks a lot!