All you have to do is turn the sentence into a question, then answer the question. If the answer ends with a vowel (he/she/they... and yes, Y is sometimes a vowel), your question also ends with a vowel (who); if the answer ends in a consonant (him/her/them), so should your question (whom).
Example:And while we're at it, let's remember that prepositions do not go at the end of the sentence. You cannot say (without making me cringe, anyway) "Whom did you go to the opera with?" It is always "With Whom"! The preposition must go first!
- With whom did you go to the opera? I went with him/her/them.
- Who invited you to the opera? He/she/they invited me.
Now, of course, in spoken English this isn't such a big deal; if you go around asking your friends "With whom did you go to the sock-hop?" you're going to sound like a snooty queen. But if you're on television, giving a speech, or writing... for God's sake keep those prepositions away from the ends of your sentences!
Oh, and by the way, continuing your sentence after putting the preposition at the end of the clause is plain old cheating. "I can't find anyone to go to the sock-hop with because I'm ugly" is still incorrect! On the other hand, you shouldn't say "I can't find anyone with whom to go to the sock-hop because I'm ugly" because it will sound stilted and silly. If you can't say it naturally, don't say it at all. Instead, you can say "I can't find anyone to go to the sock-hop with me because I'm ugly" or "I'm not going to the sock-hop because I'm too ugly to find a date." Either are correct.
So now you know. Go forth and sin no more, my children.