Required formula

  • Thread starter Thread starter vijay
  • Start date Start date
V

vijay

hi,
i am working on the excel sheet everyday i need a solution that would save
my time Question as below
In Excel.
A B C D E
F G
start time End time Client Customer
1 ? ? ANN JACK 09/11/08
0911/08
2
3
4
5
Whenever i enter ANN in Column "C1" the column "A1" should show the current
time of the system as start time, as so on When i key JACK in column "D1" the
column "B1" should show the current time as end time. so number of enteries
are made so need to save the time i need a formula.
 
vijay,

You need to use a worksheet event. Copy the code below, right-click the sheet tab, select "View
Code" and paste the code into the window that appears. The code will but the time into either
column A or B, and the date into E or F (not sure why you included G).

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Range("C:D")) Is Nothing Then Exit Sub
Application.EnableEvents = False
With Target(1, -1)
.Value = Time
.NumberFormat = "hh:mm"
End With
With Target(1, 3)
.Value = Date
.NumberFormat = "mm/dd/yy"
End With
Application.EnableEvents = True
End Sub
 

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