LOCK TIME

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HIYA
how can i lock the time in a cell when using the now function

am developing a vehicle log , and nned it to recored the time a vehicle
arives on site based on when a action is performed

example being
if a2 is activeated then b2 = time
if a3 is activated then b3 = time
ect,

the problem im having is that by using the now function all the times change
to the last entry time instead of leaving the previous times as they were
 
Once a cell has the correct time you need to replace the function by it
value, then it is frozen:

select the cell
Edit/Copy
on the same cell
Edit/Paste Special/Value
 
Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
.Offset(0, 1).Value = Format(Time, "hh:mm:ss")
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--

HTH

RP
(remove nothere from the email address if mailing direct)
 
thanks for you answer, but what im looking for is a way for excell to auto
"paste special" the cell so it does not change. the form is intended to be
used by anyone with only on click
 

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