Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / March 2007

Tip: Looking for answers? Try searching our database.

Sumif from VBA Type mismatch

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mdalamers - 07 Mar 2007 23:13 GMT
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.
Dave Peterson - 07 Mar 2007 23:19 GMT
Check your other post.

> Please help me.
>
[quoted text clipped - 15 lines]
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.aspx/excel-functions/200703/1

Signature

Dave Peterson

Martin Fishlock - 07 Mar 2007 23:26 GMT
You need to qualify the address using a range object as in if you are using
the activesheet:

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

Signature

Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.

> Please help me.
>
[quoted text clipped - 11 lines]
>
> Michiel.
mdalamers - 07 Mar 2007 23:56 GMT
Thanks Martin. That worked well!

Now I can finally go home!

M.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.