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 compare data evolution

Option Explicit

Private oldCell

Const kTarget As String = "H10"

Private Sub Worksheet_Activate()
oldCell = ActiveCell.Value
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address(False, False) = kTarget Then
MsgBox "Was " & oldCell & ", and is now " & Target.Value
oldCell = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(False, False) = kTarget Then
oldCell = Target.Value
End If
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)


"Willow" wrote in message
...
Using the event Worksheet_Change, is that possible to compare the data in
cell before the change with the one which fire the macro ?
I'm running under Excel 97 !