Cell E12 is merged with cell F12.
If I clear the contents of cell E12 by hitting the "delete" key, cell c39 doesn't change.
If I clear the contents of the cell E12 by using backspace+enter, cell c39 does update.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$12" Then
Range("d28").Value = Range("e12").Value
If Range("e12") = "" Then ' update cell c39 with calculator
Range("c39") = "Do you ?"
Else
Range("c39") = "Do you " & Range("e13").Text & "?"
End If
End If
End Sub
This will work if E12 is included in the selection when
Delete
is pressed. This is necessary because when you hit theDelete
key, Target.Address is evaluated asRange("E12:F12")
, but when you enter a value inE12
Target.Address is justRange("E12)
.This will also be triggered if all of column E is selected, cells A1 and E12, etc. That's what the
Intersect
operation does, and I'm guessing that's what you want.Note that I also added code to turn
EnableEvents
off and on, before and after the heart of your code runs. This keeps your code from triggering additionalWorksheet_Change
events.