Chapter 14
VBA Programming Examples
IN THIS CHAPTER
Working with ranges in your VBA code
Changing Boolean and non-Boolean settings
Manipulating charts with VBA
Making your VBA code run as fast as possible
A good example often communicates a concept much better than a lengthy description of the underlying theory. In that spirit, this chapter presents several examples to demonstrate common VBA techniques.
These examples are organized into the following categories:
- Working with ranges
- Changing Excel settings
- Working with charts
- Speeding up your VBA code
Although you might be able to use some of the examples directly, in most cases you must adapt them to your own needs.
Working with Ranges
Most of your VBA programming probably involves worksheet ranges. (For some background on Range objects, refer to Chapter 8.) When working with Range objects, keep the following points in mind:
- Your VBA doesn’t need to select a range to work with it.
- If your code does select a range, its worksheet must be active.
- The macro recorder doesn’t always generate the best code. Often, you can create ...
Get Excel VBA Programming For Dummies, 6th Edition 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.