The use of whoever and whomever depends on the pronoun’s function in the sentence. Whoever stands in the subject position, while whomever is an object:
- I don’t want to see them, whoever they are.
- Whoever leaves last should lock the door.
- She always smiles at whomever she meets.
A simple way to determine whether whoever or whomever can be used is to try the sentence with he/she or him/her. If he/she can be used, choose whoever, while in the case of him/her the pronoun can be whomever:
- Give the letter to whoever answers the door. (He/she answers the door.)
- Give the letter to whomever you see first. (You see him/her first.)
Don’t be misled if there is a transitive verb or a preposition before whoever/whomever, as there are usually two clauses in the sentence, and you should consider whether whoever/whomever is the subject or object of the subordinate clause, not the main clause.
- She always smiles at whomever she meets. (Here the whole clause ‘whomever she meets’ is the object of ‘She smiles at’, so this would not require the objective form ‘whomever’)
you could say
- She smiles at whoever visits her. (the objective form is used because whomever is the object of ‘she meets’ in the subordinate clause).