可使用单元格的formula进行更改:
Sub Formula_()
Dim i As Single
Dim a As Range
Set a = Cells(1, 1)
i = Application.WorksheetFunction.Find("(", a.Formula)
a.Formula = "=" & "count" & Mid(a.Formula, i, Len(a.Formula) - i + 1)
End Sub
Range("a1").Formula = Application.WorksheetFunction.Substitute(Range("a1").Formula, "SUM", "COUNT")
公式必须用大写字母