Thread: Date Event
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Date Event

Gregor,

Here is some event code. It works if any cell in A1:A100 is selected and
then does that compariosn.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
If Me.Cells(.Row, "I").Value = Me.Cells(.Row, "H").Value Then
.Value = Date
.NumberFormat = "dd mmm yyyy"
Else
.Value = "INCOMPLETE"
.NumberFormat = "@"
End If
End If
End With

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)


"gregork" wrote in message
...
I have the following formula on my worksheet that I was going to use to
record a date when a stock level is reached:

IF($I3=$H3,TODAY(),"INCOMPLETE")

Of course its not gunna work because after all 'tomorrows another day' so

my
formula is going to return a different date.
What I need is the exact day that I3 =H3 to be noted so I guess I need an
event right?
I also need it to work on a range of cells. Not sure how to go about this.

GK