Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell_1 As Range, cell_2 As Range, cell_T As Range, rng As Range
Set cell_T = Range("C2") 'fit the cells to your needs
Set cell_1 = Range("C3")
Set cell_2 = Range("C4")
Set rng = Intersect(Target, Union(cell_1, cell_2, cell_T))
If Not rng Is Nothing Then
Application.EnableEvents = False
If cell_1 = "" And cell_2 = "" Then
If cell_T.HasFormula Then cell_T.Value = ""
Else
cell_T.Formula = "=SUM(" & cell_1.Address & ":" & cell_2.Address & ")"
End If
Application.EnableEvents = True
End If
End Sub