Auto Date and Time.

  • Thread starter Thread starter POONAM
  • Start date Start date
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top