Parameters of SUMIF in VBA

  • Thread starter mdalamers via OfficeKB.com
  • 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.
 
D

Dave Peterson

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

Watch your ranges, too (226 or 224????).
 
M

mdalamers via OfficeKB.com

GREAT that did the trick!

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top