Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Sumif from VBA Type mismatch

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...tions/200703/1

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Sumif from VBA Type mismatch

Check your other post.

"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...tions/200703/1


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Sumif from VBA Type mismatch

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


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


"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...tions/200703/1


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Sumif from VBA Type mismatch

Thanks Martin. That worked well!

Now I can finally go home!

M.

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run-time 13 Type mismatch simonsmith Excel Discussion (Misc queries) 2 May 18th 06 04:14 PM
Type Mismatch Error David Excel Discussion (Misc queries) 2 December 11th 05 04:46 PM
type mismatch--how to fix rroach Excel Discussion (Misc queries) 2 July 14th 05 06:23 PM
Type mismatch on LastRow daniel chen Excel Discussion (Misc queries) 8 April 11th 05 02:29 AM
Why type mismatch - R/T error 13 Jim May Excel Discussion (Misc queries) 5 January 9th 05 06:45 PM


All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"