Is there any event to detect if DELETE key pressed on a cell in the sheet?
Here is my sample code:
Public Sub Worksheet_Selection_Change(ByVal Target As Range)
oldValue = Target.Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
newValue = Target.Value
If oldValue <> newValue Then "Do Somthing"
End Sub
Assume A1=10, you select A1 and delete the value. So newValue=NULL and oldValue=10 Then you Instantly type "20" in the cell, So newValue=20 and oldValue should be NULL, but it is still "10". I need to check if Delete key is pressed to update the oldValue
Private Sub Worksheet_Change(ByVal Target As Range)
newValue = Target.Value
If "Delete key Pressed" Then oldValue = ""
If oldValue <> newValue Then "Do Somthing"
End Sub