A1 Style References
Sub m() Range("D5").Value = "=SUM(D1:D4)" Range("D5").Formula = "=SUM(D1:D4)" End Sub