【求助】在Excel VBA中怎么写sumif函数

2024-12-30 03:35:43
推荐回答(3个)
回答1:

如果要写公式,就直接用双引号括起来即可,如: range("C9")="=SUMIF(M:V,A9,V:V)"
如果想直接得到值:range("C9")=WORKSHEETFUNCTION.SUMIF(CLOUMNS("M:V"),RANGE("A9"),CLOUMNS("M:V")

回答2:

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))

回答3:

worksheetfunction.sumif.