View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jan Kronsell Jan Kronsell is offline
external usenet poster
 
Posts: 99
Default Workdheet.BeforeChange

The problem is, that the cell is not always selected. Maybe the change
happens in the cell that is already active, when the workbook is opened.

Jan

Mike H wrote:
Hi,

You can use worksheet_selectionchange. When a cell is seleceted using
this event capture the value. A very simple example of that is below
and it doesn't matter if the cell isn't changes you simply don't use
the variable.

Public lastval As String
Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox lastval
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
lastval = Target.Value
End Sub

Mike



" 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