View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Workdheet.BeforeChange

You can use undo

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
NewData = Target.Formula

Application.Undo
OldData = Target.Formula
Target.Formula = NewData
Application.EnableEvents = True

End Sub

" wrote:

When I use

Private Sub Worksheet_Change(ByVal Target As Range)

og a cell containing a formula, Target.Formula is the Formula after
the change has happened. Is there any way to get the Formula that is
in the cell BEFORE the change happens? I cannot use

Private Sub Worksheet_SelectionChange(ByVal Target As Range) to grab
the formula, as the user is not necessarilu selecting the cell before
the change.

Regards
Jan