VBA Programming Examples and Techniques

IN THIS CHAPTER

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. Visual Basic for Applications (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.

♦ Examples of using VBA to work with ranges

♦ Examples of using VBA to work with workbooks and sheets

♦ Custom functions for use in your VBA procedures and in worksheet formulas

♦ Examples of miscellaneous VBA tricks and techniques

♦ Examples of using Windows Application Programming Interface (API) functions

The previous chapters in this section 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

Using the Examples in this Chapter

Not all the examples in this chapter are intended to be standalone programs. They are, however, set up as executable procedures that you can adapt for your own applications.

I urge you to follow along on your computer as you read this chapter. Better yet, modify the examples and see what happens. I guarantee that this hands-on experience will help you more than reading a reference book.

Subsequent chapters in this book present additional feature-specific examples: charts, pivot tables, events, UserForms,and so on.

XREF

0 0

Post a comment