[Solved] seeking a solution for when user decrements a cell’s value, another cell (different column) will increment that same value


Here is an example for columns A and B. Insert this event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim A As Range, OldValue As Variant, NewValue As Variant, Delta As Variant
    Set A = Range("A:A")
    If Intersect(Target, A) Is Nothing Then Exit Sub
    If Target.Count > 1 Then Exit Sub

    Application.EnableEvents = False
        NewValue = Target.Value
        Application.Undo
        OldValue = Target.Value     'capture previous value
        Target.Value = NewValue    'restore new value
        If NewValue < OldValue Then
            Delta = OldValue - NewValue
            Target.Offset(0, 1).Value = Target.Offset(0, 1).Value + Delta
        End If
    Application.EnableEvents = True
End Sub

If a value in column A is reduced by user action, the value in column B (in the adjacent cell) will be increased by the same amount.

If the value in column A is increased, then no action is taken. If more than one cell in column A is changed at the same time, no action is taken.

solved seeking a solution for when user decrements a cell’s value, another cell (different column) will increment that same value