Try this....

Paste this in the sheet code module

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Cells(1).Column <= 2 Then
        With Me
            .Range("C2:C" & Application.Max(2, Me.Cells(Rows.Count, 3).End(xlUp).Row)).ClearContents
            .Range("C2:C" & Application.Max(.Cells(Rows.Count,  1).End(xlUp).Row, .Cells(Rows.Count, 3).End(xlUp).Row)).Formula =  "=A2-B2"
        End With
    End If
        
End Sub