Chapter 11: VBA Programming Examples and Techniques

IN THIS CHAPTER

Using VBA to work with ranges

Using VBA to work with workbooks and sheets

Creating custom functions for use in your VBA procedures and in worksheet formulas

Trying miscellaneous VBA tricks and techniques

Using Windows Application Programming Interface (API) functions

Learning by Example

I believe that learning programming concepts is accelerated by a heavy emphasis on examples. And based on the feedback that I've received from readers of previous editions of this book, I have plenty of company. VBA programmers especially benefit from a hands-on approach. A well-thought-out example usually communicates a concept much better than a description of the underlying theory. I decided, therefore, not to write a reference book that painstakingly describes every nuance of VBA. Rather, I prepared numerous examples to demonstrate useful Excel programming techniques.

The previous chapters in this part provide enough information to get you started. The Help system provides all the details that I left out. In this chapter, I pick up the pace and present examples that solve practical problems while furthering your knowledge of VBA.

I've categorized this chapter's examples into six groups:

Working with ranges

Working with workbooks and sheets

VBA techniques

Functions that are useful in your VBA procedures

Functions that you can use in worksheet formulas

Windows API calls

Subsequent chapters in this book ...

Get Excel® 2010 Power Programming with VBA now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.