Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim iRow As Long
iRow = Target.Row 'получаем строку ввода и только для неё проводим изменения
For iRow = 2 To 10
If Target.Column = 2& Then
If IsNumeric(Cells(iRow, 3&).Value) And IsNumeric(Cells(iRow, 2&).Value) Then
Cells(iRow, 3&).Formula = "=" & Cells(iRow, 3&).Value & "-" & Cells(iRow, 2&).Address
End If
ElseIf Target.Column = 1& Then
If IsNumeric(Cells(iRow, 1&).Value) And IsNumeric(Cells(iRow, 3&).Value) Then
Cells(iRow, 3&).Formula = "=" & Cells(iRow, 3&).Value & "+" & Cells(iRow, 1&).Address
End If
End If
Next iRow
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim iRow As Long
iRow = Target.Row 'получаем строку ввода и только для неё проводим изменения
For iRow = 2 To 10
If Target.Column = 2& Then
If IsNumeric(Cells(iRow, 3&).Value) And IsNumeric(Cells(iRow, 2&).Value) Then
Cells(iRow, 3&).Formula = "=" & Cells(iRow, 3&).Value & "-" & Cells(iRow, 2&).Address
End If
ElseIf Target.Column = 1& Then
If IsNumeric(Cells(iRow, 1&).Value) And IsNumeric(Cells(iRow, 3&).Value) Then
Cells(iRow, 3&).Formula = "=" & Cells(iRow, 3&).Value & "+" & Cells(iRow, 1&).Address
End If
End If
Next iRow
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub