如果要写公式,就直接用双引号括起来即可,如: range("C9")="=SUMIF(M:V,A9,V:V)"
如果想直接得到值:range("C9")=WORKSHEETFUNCTION.SUMIF(CLOUMNS("M:V"),RANGE("A9"),CLOUMNS("M:V")
Dim Rg1 As Range
Dim Rg2 As Range
Dim Rg3 As Range
Set Rg1 = Worksheets("Sheet1").Range("M:V")
Set Rg2 = Worksheets("Sheet1").Range("A9:A9")
Set Rg3 = Worksheets("Sheet1").Range("V:V")
Worksheets("Sheet1").Range("C9") = Application.WorksheetFunction.SUMIF(Rg1,Rg2,Rg3))
worksheetfunction.sumif.