Blizzard has posted an in-depth guide to macros in World of Warcraft, starting with the basics of what they are and how to make one, then moving on into more specific detail.
In a game with the size, complexity, and depth of World of Warcraft, many features can be overlooked by players, including longtime veterans who have been playing for years. Even the game's familiar features often have additional layers of complexity that many players may not use or be aware of.
Thus, we come to the macro. Essentially macros are lines of script that execute in-game commands. They allow you to combine multiple actions into one user-customized button that you can use just like a spell or ability. For example, you can take a string of commands that you would ordinarily press one after the other, and combine them into one button that executes them all in sequence. These helpful tools have the ability to improve and streamline your entire play experience.
Read more about macros here.