Refitting Cable to Rear Derailleur Whilst riding recently the cable slipped from the clamp on the rear derailleur.

I'm attempting to affect repairs by re-clamping the cable. However by pulling the cable tight I have lost the bottom 2 gears. If I then slacken the cable just a small amount I gain the bottom gears again but lose the top gear. I can't seem to reach a balance.

This is the first time I've had to fit a cable to a derailleur, are there any tips? Am I potentially doing something wrong? Do I have to be in a certain gear before attempted to re-attach the cable to get the correct balance?
Are you sure the cable is clamped correctly? Having that wrong can change the amount the derailleur moves for a given amount of pull (in fact it's sometimes done deliberately to use mismatched components - http://sheldonbrown.com/drivetrain-mixing.shtml#alternate).
Otherwise, make sure the cable moves smoothly through the housing and that the hanger isn't bent, then work through:
http://www.parktool.com/blog/repair-help/rear-derailler-adjustments-derailleur and/or
http://sheldonbrown.com/derailer-adjustment.html