View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie David McRitchie is offline
external usenet poster
 
Posts: 903
Default how do i auto insert a date and time stamp

Couple of items with this question and suggestion.
The question was answered exactly as asked, but you probably
want to put the datetimestamp into a specific column
and not haphazardly next to any cell that has data entered into it,
perhaps column C when column B is filled in. So it
needs to check that the current (target) cell is in column 2
and probably that it is not row 1. Since John also answered
you would be able to see such things in his code.

My page on getstarted.htm is for regular macros there is
a link right at the top for event macros which is what that code
is and that page is
http://www.mvps.org/dmcritchie/excel/event.htm

But you picked up on one important item and that is to turn of
Event checking when changing the cells with a change event
macro. If there is a problem with the macro the event checking
has to be reenabled when is described near the end of the above
http://www.mvps.org/dmcritchie/excel/event.htm#problems
I don't normally mention that when I send people to event.htm
but it can be a problem.

---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Gary''s Student" wrote in message
...
Enter the following macro in WorkSheet code:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Target.Offset(0, 1).Value = Now()
Application.EnableEvents = True
End Sub

If you are not familiar with VBA, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary's Student
gsnu200703


"cjensen" wrote:

I would like to know how to have excel automaticaly insert the date and time
if the adjacent cell is in use. I need the date and time to reflect the time
that the entry was made and not change