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.
 

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

Similar Threads

Sumif from VBA Type mismatch 3
Delimma: SumIf worksheet function 0
sumif in vba 2
sumifs question 2
Formula Array Help in VBA 3
loop help 6
VBA : Sumif on different workbooks! ********* 1
Help with SUMIF in VBA 1

Back
Top