You cannot use a dimmer switch on a fan motor, but you can find fan speed controllers.
A regular dimmer switch simply reduces the voltage. That works with lights, but will burn out a motor (and maybe burn down the house).
A fan speed controller is a much more complex electronic device that reduces the amperage to the motor without reducing the voltage.
Avoiding this kind of innocent mistake is one of the reasons many electricians feel that DIY electrical work should be banned. Look carefully at the packaging of the switches at the store. These days you will find an indication as to whether this switch is for a light, for a halogen light, or for a ceiling fan, or in a dual unit, for both with two different sliders in one unit.
One caution. All of these light and fan controls require that there be more than two wires coming down from the fan to the wall switch location. Check that out before you put the money out for a switch that you may not be able to install, unless you are ready to run a new wire through the walls and ceiling.
There used to be a great gadget for getting around that third wire -- but unfortunately great ideas often disapper for a lack of sales volume. This was a little black box that you put into the ceiling electrical box and connected the fan to it. Then it would decode a kind of morse code from the very ordinary switch down on the wall. It was kind of like a single or double mouse click. Turn the switch on and you get the lights alone. On-off-on and you get both the fan and the light. On-off-on-off-on and you get the fan alone. All of this with the ordinary two wire light switch. 10 years after I showed this on the TV show, when I Google for Fan-E-Zee, all I get is this article. Sad.
Click here for information on the LEGALITY OF DIY ELECTRICAL WORK.