RTFM.
Or rather, take a decent sized macro, and go through it top to bottom like others recommended, and look up everything you don't know (or ask if it's not well documented..but make sure it's not first) until you understand it well enough that you could rewrite it if necessary. Don't just learn the pieces, try to learn the logic and the flow of the macro as well. Do this a few times and you should be able to write anything you want.