A friend told me she'd read that you get one exclamation point every one hundred thousand words, and maybe this is true if you're writing your thesis, but certainly not dialogue in a YA or MG novel. They can also pop up in a character's thoughts and, in informal fiction or fiction with a strong POV, can show up practically anywhere. Of course, this doesn't mean there aren't limits.
The exclamation point is one of many little things that are just oh-so-fun to do in your writing. Usually, they're fun because they're actually quite effective at what they're meant to do: convey mood, add to rhythm or voice of the writing, or just wrap up a paragraph nicely. And while some people disparage these techniques - "These are tricks that your writing shouldn't need" - I disagree. Like anything else in writing, they can be done poorly or done well, but they can be great tools in the writer's utility belt. ("Quick, Robin, the bat-ellipses!") Yes, they do, in part because of their effectiveness, lend themselves to being overused. But fear not. Even outside of dialogue, as long as you don't go overboard:
You can use exclamation points. People definitely use them when they talk, but that isn't all. People - especially certain kinds of people - use them when they think. This can be an opportunity to help ground your story's POV as well as convey the POV character's mood. After all, think about the difference between, They couldn't invite the officer in. She'd see the body. and They couldn't invite the officer in! She'd see the body!
You can use sentence fragments. (I feel like someone hawking the allowances of a new diet. Chocolate! Pizza! Sentence fragments!) I like these most when completing the thought as a proper sentence would force me to be repetitive or use a less-than-punchy phrase. They're quite useful with sounds, for example: He listened hard in the darkness. Distant splashing, a yelp, and then nothing. Note the absence of a boring and obvious phrase like "he heard." Sentence fragments are not the only way to solve this problem, but they are a perfectly good one.
You can use ellipses. These are great. Not only are they a well-recognized standard for what they do - indicating a pause or a thought trailing off, especially in thought or dialogue - but they provide a little visual variation to the text. This does make it extremely obvious if you overuse them, but that only makes it that much easier to catch. You do want to be careful that you're not redundant with them. That is, if something is obviously left unknown, like an uncertainty being pondered at the end of a chapter, you may not want to underscore the point by tacking on ellipses at the end of that thought.
You can use words like "rather," "quite," and "just" in ways that don't really add to the strict meaning of sentences. Some people frown about this, but most see the value it offers as part of a story's voice. Just be extremely careful about overuse. This is one of the many places that reading your work aloud can save you.
And in dialogue, you can have characters use each other's names. Just not all the time. (That's what today's entry really is: things that are so much fun that you want to use them all the time, but you can't.) This is great for drama and/or emotional connection between characters. You just don't want to be all like (drawing two completely random names out of the Hat of Unimpeachable Randomness):
"What is it, Edward?"
"You have to understand, Bella. You're in danger. Lots of dangerous people are looking for you, Bella."
"But you'll protect me, Edward."
(I shook the Hat really well. I'm as surprised as you are.)
As I said, with a little moderation, these are great. *Insert analogy about cooking with spices.* And of course, this applies to any writing technique: metaphors, rhetorical questions, description, exposition. The ones mentioned here are just some that I'd heard maligned, so I thought I'd throw out my tuppence on the subject.