Use sparingly and only to express a high degree of surprise, disbelief or other strong emotion. The exclamation point goes within the quotation marks when it applies to the quoted matter only.
F. Scott Fitzgerald: "Cut out all those exclamation marks. An exclamation mark is like laughing at your own joke."