Option Explicit
Sub Convert_Formula_To_VBA()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet1")
With ws
With .Range("D4")
.Formula = "=COUNTIFS($A$1:$A$20,"">=01/01/2020"",$A$1:$A$20,""<=10/01/2020"")"
.Value = .Value
End With
End With
End Sub