I tried it using the attached workbook and the below code, if worked for me:
Sub test()
Dim i As Integer
i = 3
ActiveSheet.Range("A" & i).Formula = "=COUNTIFS('SpreadsheetA'!J:J,TEST!B" & i & ",'SpreadsheetA'!D:D,"" > ""&Control!C5)"
End Sub