When content of a cell changes, content of another deletes
Paste the following code into the sheet module in the VBA Editor for the
worksheet where you want this to happen (Alt-F11 to open the VBA Editor, then
Ctrl-R to display the Project Explorer. For Sheet1, click on Sheet1, etc.)
Private LastVal
Private Sub Worksheet_Activate()
LastVal = Range("A1").Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then Exit Sub
If Range("A1").Value < LastVal Then
Range("B1").Delete
LastVal = Range("A1").Value
End If
End Sub
Hope this helps,
Hutch
" wrote:
If a formulated value in A1 changes to any value after a value is
manually entered in B1, I need the content of B1 to be deleted. In
other words, 1) A1 first reflects a formulated value, 2) a value is
manually entered into B1, 3) input elsewhere causes A1 to return a
different calculated value, 4) thus causing B1 to delete its input.
Is there a simple macro that will accomplish this? Thanks in advance.
Michael
|