Unable to get the SumIf property of the WorksheetFunction class

phalcon45

New Member
Joined
Nov 4, 2015
Messages
19
I've got another noodle scratcher here that Im hoping one of you amazing brains can help me with.
I've got a script that runs a bunch of functions, sets a bunch of Dim values, sorts stuff etc.
Its been running great but all of a sudden today it gets to line 774 where Im asking it to set a Dim based on a SumIf function and it throws up the error "Unable to get the SumIf property of the WorksheetFunction class" error

Weirdest part (to me anyway) is that I use almost identical lines several times earlier on in the script.
The Dim JRCount is set, used and reused several times earlier in the script. In the most recent case JRCount gets set to 76.
MC is set as a Dim in the beginning of the script and its set used, and reset to new values (also using sumif) and re-used several times before it gets to the fail point.
That all being said, the line it fails on looks something like this

MC = WorksheetFunction.Sumif(Sheets("abcde").Range("a2:a" & JRCount), "Specific text", Sheets("abcde").Range("z2:z" & JRCount))

There are numerous instances of the specific text Im asking it to look for in the range Im asking it to look in (A2:A76).

I also dont understand why this line in almost exactly the same syntax (just different sheet name that its searching on) would run fine but not when it gets to this point.

Any thoughts / help would really save the day here.

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Any error values in either column?
 
Upvote 0
Nope. I thought of the same thing and even went so far as to manually analyze the data to make sure there wasnt some rogue space at the end of the text or something weird like that.
To make maters even more confounding, if I comment out that one line and just go on to the next line, which is EXACTLY the same countif statement but with a different Dim name (EW instead of MC), it works fine.
 
Upvote 0
It can't be the same if it's a COUNTIF?
 
Upvote 0
Can you post both code lines?
 
Upvote 0
Update
I think that this might be a weird glitch. Maybe a memory issue on my computer? I've tried about everything you can imagine including deleting those lines and re-typing them in. Now I've discovered that it works sometimes and other times it fails! Sometimes if I comment out the line it failed on it goes on to the next line without issue and finishes the routine, other times it fails on that line as well. Doesnt seem to be any consistency.
I ran the same file on a different computer and havent had any issues (yet).
In any case I appreciate everyone who weighed in but at this point I think its an issue with my computer
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top