Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngInterest As Range
Application.EnableEvents = False
On Error Resume Next
Set rngInterest = Intersect(Target, Range("A1:A3"))
If Not rngInterest Is Nothing Then
If rngInterest.Cells.Count > 1 Or Target.Row = 2 Then
MsgBox "Error - Invalid Update", vbCritical, "Computer Says No"
Application.Undo
Else
Select Case Target.Row
Case 1
Range("A2").Value = Target.Value
Range("A3").ClearContents
Case 3
Range("A2").Value = Range("A2").Value - Val(Target.Value)
Target.ClearContents
End Select
End If
End If
Application.EnableEvents = True
End Sub