ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Parameters of SUMIF in VBA (https://www.excelbanter.com/excel-programming/384773-parameters-sumif-vba.html)

mdalamers via OfficeKB.com

Parameters of SUMIF in VBA
 
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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1


Dave Peterson

Parameters of SUMIF in VBA
 
msgbox application.sumif(worksheets("sheet1").range("e1:e 226"), "0", _
worksheets("sheet1").range("N1:N226"))

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

"mdalamers via OfficeKB.com" wrote:

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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1


--

Dave Peterson

mdalamers via OfficeKB.com

Parameters of SUMIF in VBA
 
GREAT that did the trick!

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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1



All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com