Page 6 of 24PREVNEXT

Get in the loop with Excel macros

Creating and naming a  macro

Give your macro a name.

To actually write a macro, you'd type the word Sub in the module window. (Why? It doesn't matter. It's just that way.) Next you'd type a space and then the name of your macro. If you typed Sub MyMacro, for instance, you'd create a new macro called MyMacro. Because the Visual Basic Editor is so smart, it would automatically insert a line below your Sub line that said End Sub — how convenient! You've got the beginning and the end, now all you need is some code between them, in the handy new space.

Page 6 of 24PREVNEXT