View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default cell with static current time

Here is an example using A1 and B1. Data goes in A1 and the time is tagged
in B1. If you insert OUT (data validation or manually) the time is
statically recorded in B1. Once the time is entered, it will not update,
even if somebody comes along and messes with A1.

The only way to refresh B1 would be to clear it. That allows re-tagging:

Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
If Range("A1").Value < "OUT" Then Exit Sub
If Range("B1").Value < "" Then Exit Sub

Application.EnableEvents = False
Range("B1").Value = Time
Application.EnableEvents = True
End Sub

Note that this is Worksheet Event code. It does NOT go in a standard module.
--
Gary''s Student - gsnu200743


"ben w" wrote:

cell has list validation

"Gary''s Student" wrote:

Does the cell change because of manual entry or does it have a formula in it?
--
Gary''s Student - gsnu200743


"ben w" wrote:

i would like a cells in a column to display the curent static time the cell
in the previous column is a certain value
ex:
if cell value is "out" or not "in" then next cell to display when value
changed.
any answers? macros, formulas, setting changes?