Auto Date and Time.

P

POONAM

I have multiple coloumns with ac/no, date, time, quantity.
New enetries are made every few minutes.
Each time after ntering ac/no i hit TAB and then enter
current date and then hit TAB and enter current time.
Is there any way i can have current date automatically
inserted when cell is selected? and same with time in next
coloumn?
Thanks.
 
N

Norman Harker

Hi Poonam!

You need a Worksheet_Change subroutine such as:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If .Column = 1 Then ' Entry in column A
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy"
.Value = Now
With .Offset(0, 2)
.NumberFormat = "hh:mm:ss"
.Value = Now
End With
End If
End With
End Sub

This goes in the sheet module for the sheet with the cells to be date
stamped. Adapt for the number of the column that you are entering data
into.
 
Top