The rules for using a comma before quotation marks can seem arbitrary, but you only need to commit a couple to memory. Use a comma after verbs of communication introducing a quotation and between split quotations. Study the following examples to help you avoid the most common mistakes.
Use a comma after verbs of communication, such as "asked" or "said," when they come right before a quote. For example: The short fellow asked, "How's the weather up there?"
Insert a comma after the clause between the first and second part of a split quote. For example: "No one is here yet," she complained, "and it's almost midnight."
Leave out the comma when the first part of a quote ends with an exclamation point or question mark. Instead, use a period, as in the following example: "You fools!" the terrorist cried to his minions. "How could you let the prisoners escape?"
Do not use a comma after a subordinate clause that introduces a quote. In this case, no punctuation is necessary. For example: She told me that I should "kick back and put my feet up."