The record function will get you off to a good start. Then you can tweak the code as necessary. Just google what you want to do and there will be 30 random people who have posted it on some excel related forum.
It sounds like using the index and match functions in excel are better suited to what you're trying to do though.
If you give more details as to what exactly you're trying to do, I might be able to help you.