Parameters of SUMIF in VBA

  • Thread starter Thread starter mdalamers via OfficeKB.com
  • Start date Start date
M

mdalamers via OfficeKB.com

Please help me.

I try to run a SUMIF worksheet function from my VBA code.
Basically this is the troublesome line.

MsgBox Application.WorksheetFunction.SumIf("$E$1:$E$226", ">0", "$N$1:$N$224")


When I run it, Excel gives me a compile error, type mismatch, highlighted on:
"$E$1:$E$226"

What am I doing wrong?

Regards,

Michiel.
 
msgbox application.sumif(worksheets("sheet1").range("e1:e226"), ">0", _
worksheets("sheet1").range("N1:N226"))

Watch your ranges, too (226 or 224????).
 
GREAT that did the trick!

PS sorry for my double post. I did not figure out how to delete a thread.
 
Back
Top