NOW() function

R

redingto

I'm trying to create an automated time-card file, where you enter your name
in one column and automatically the date is entered in a second column and
the current time is entered in a third column. So far, so good! (Yes, I can
get this to happen!). However, the problem arises with the NOW()
function..... whenever you enter a value for NOW() in any cell, it changes
the value of NOW() EVERYWHERE on the worksheet! So no matter when you enter
your name originally, the time listed will always be the time the last person
entered their name! Any idea how to correct this?
 
D

David Billigmeier

You need to use some VBA to do this, the following will work. Tweak the
Offset() function to get the right cells you like. The first input changes
the row, second changes the column.

Sub worksheet_change(ByVal target As Range)
ActiveCell.Offset(-1, 1) = Now() 'format as date
ActiveCell.Offset(-1, 2) = Now() 'format as time
End Sub
 
Top