Logical test

G

Guest

I am creating a spreadsheet application on Excel 2000 to record the time (24
hour clock) when checks are made each day of the week by a person’s
identification. To accomplish this, a logical test is used in the column
(say Column D) for recording the time the person made the check (say Column
E). When the validity of the person’s identity is verified, the time is
recorded.

=IF(AND(E14>200,E14<226),NOW(),†“) The problem is, when the Value_if_true
when using NOW(), records a ‘volatile’ time, i.e., the time is not retained
for that entry, when the test is performed on another day. All times in the
column change to the current NOW(). Once entered, it is intended the time
entered in a Row will not change when subsequent person’s identity is
verified.

Can you help?
 
J

JE McGimpsey

Take a look here:

http://www.mcgimpsey.com/excel/timestamp.html


You'll have to modify the macro somewhat. Perhaps one way:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim bValid As Boolean
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("E2:E100"), .Cells) Is Nothing Then
If IsNumeric(.Value) Then _
bValid = (.Value > 200) And (.Value < 226)
On Error GoTo ErrorExit
Application.EnableEvents = False
With .Offset(0, -1)
If bValid Then
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
Else
.ClearContents
End If
End With
ErrorExit:
Application.EnableEvents = True
End If
End With
End Sub
 
G

Guest

Thank you, but your recommendation still results in an error message.
Comparing your initial reply with the section 'Using a worksheet event macro'
from your Time and Date Stamps article, you apparently attempted to create a
macro to satisfy my needs. I have had very little experience with macros and
obviously can't pick up on the error myself. I also applied 'Using circular
references and worksheet functions' from the same article which produced the
desired results, but without the validity limitation of the of the values -
200 and <226.

What am I not seeing? Thanks again
 

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

Top