Like the objective pronoun whom, whomever works only as an object of a verb or preposition. Everywhere else, the correct pronoun is whoever (which, like who, is a nominative pronoun). Think of it this way: Whoever acts, and whomever is acted upon.
Examples
Misuse of whomever is very common. For example, whomever is questionable in the following sentences because a nominative pronoun (i.e., one that acts) is called for:
Why not just have everyone fill out a purity exam and whomever hews closest to the conservative line wins? [Dallas Morning News]
He did say, however, that whomever holds the seat in the future must remain vigilant. [Berkshire Eagle]
Whomever made the ancient paint selected only the brightest of reds. [AZ Central]
And in the following examples, whomever works because an objective pronoun (i.e., one that is acted upon) is called for:
That is how some Republicans characterized President Obama’s latest attempt to raise taxes on whomever he means by “the rich.” [American Thinker]
But all of us still have a right to criticize whomever we choose. [Charleston Post and Courier]
Whomever the Sox hire, he must bring in a strong-minded pitching coach to deal with this staff. [Boston Globe]