Workbook_SheetChange event

P

PO

Excel 2003, Sp2

Hi

I want to track changes in cells made by the user in the workbook. I use the
Workbook_SheetChange event.
The example below prints the value the user changed TO. Howerver, sometimes
I want to print the value the user changed FROM.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Debug.Print Target.Value
End Sub

How can I find out the value the user changed FROM?

Regards
Pete
 
P

paul.robinson

Hi
You could capture the cell value when the user selects the cell

Public FromValue As Variant

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
FromValue = Target.Value
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Debug.Print Target.Value
Debug.Print FromValue
End Sub

regards
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top