Microsoft Office Tutorials and References
In Depth Information
VBA: Written Behind the Scenes
Figure 11–17. The Logo macro in VBA
Now that may look pretty scary at first glance, but take a closer look. Many of the VBA
entries will start to make more sense when you study the terms they use. Note, for
example, the reference to "Gidget's Widgets" (see the first arrow in the figure) beneath
the line that reads Range ("A1").Select . That means that the macro selects cell A1 and
proceeds to enter “Gidget’s Widgets” there.
Now look at the line that reads as follows (see the bottom arrow in Figure 11–17):
.Size = 14
You’ll probably, and correctly, interpret that bit of programming code as an instruction to
change the font size of the logo to 14 points, as our macro specified. But what that also
means is that you can simply click the number 14, delete it, and type, say, 10 instead.
That editing change will downsize the logo text to 10 points the next time you run the
macro. And if you delete Widgets and replace it with Gadgets , the next time you run the
macro you’ll see “Gidget’s Gadgets” in cell A1. Try it.
NOTE: Keep in mind that after you make such changes, you can close that VBA window; the rest
of the workbook displaying your logo will nevertheless remain open, and you can try the macro
again and continue to work on that worksheet.
Once you study how the VBA code operates, you’ll be able to make small changes like
these pretty easily. And it beats having to record the whole macro over again.
 
Search JabSto ::




Custom Search