I am trying to create a Sub that places a SUMIF
formula in a cell. I have reduced the problem to a simple setup:
Private Sub CommandButton1_Click()
Cells(2, 3).Formula = "=SUMIF(A1:A5;D1;B1:B5)"
End Sub
I get a 1004 Error
.
I can run the same code but with the SUM function instead:
"=SUM(B1:B5)"
This does not produce an error. Thus I suspect the semicolons in my formula.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…