Going On from Here

In this chapter, you’ve learned how to create macros with the help of the macro recorder. As you learn more about VBA, you’ll notice that the macro recorder often creates more code for a task than you really need. In our CompanyFont macro, for example, the following lines that the recorder generated are unnecessary because all you wanted to do was set the font name, point size, and style:

.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMajor

The recorder added these lines because it didn’t (and couldn’t) know they weren’t necessary. You can remove them without changing ...

Get Microsoft® Excel® 2010 Inside Out now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.