Modifying the Macro

As you might expect, not only can you view your macro in the VBE, you can also change it. Try making a few changes to the macro, and then rerun it to see the effects. For example:

^ Change the name that's entered into the active cell. ^ Change the font name or size.

^ See if you can figure out the appropriate location for a new statement:

Selection.Font.Bold = True

Working in a VBA code module is much like working in a word-processing document (except there's no word wrap and you can't format the text). On second thought, I guess it's more like working in Notepad. You can press Enter to start a new line, and the familiar editing keys work as expected.

After you've made your changes, jump back to Excel and try out the revised macro to see how it works. Just as you can press Alt+F11 in Excel to display the VBE, you can press Alt+F11 in the VBE to switch back to Excel.

0 0

Post a comment