View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mike k mike k is offline
external usenet poster
 
Posts: 12
Default Worksheet_change event.

I need to record the time and date that a cell changes
states. It may change 1-2 times a day or it may not change
for 2-3 days. It's actually a string value but I
manipulated some logic to get it down to a true-false.
That worked in manual testing but not in field
conditions. I'm trying to capture a change in a PLC value
that feeds my worksheet, updating every 2 seconds. I have
a lookup table to simplify it to a number change now if
that helps.

I Have been banging on this for weeks now and I just can't
get to work. I don't have a deep enough programming
knowledge to make the correct modifications to the
worksheet_Change statement.

Below is what I had: (Got it from an earlier post in here)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Set Target = Target(1)
If Not Intersect(Target, Range("P5")) Is Nothing Then
If Target.Value = 0 Then
With Target.Offset(0, 1)
.NumberFormat = "hh:mm AM/PM"
.Value = Time
End With
End If
End If
End Sub

What I need:

Basically if cell P5 (my lookup table is converting it
from a string to a number from 1-19) changes from whatever
it was to ANYTHING else I need to record the time and date
in another cell(say Q5). Then when it changes again record
the new time and date in Q5

Hope I explained it clearly.
Win 2000
Excel 2000
Thanks,
Mike