7 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

Most beginning VBA programmers benefit from hands-on examples. A well-thought-out example usually communicates a concept much better than a description of the underlying theory. Therefore, instead of taking you through a painful review of every nuance of VBA, this chapter guides you through demonstrations of useful Excel programming techniques.

Here, you will walk through examples that solve practical problems while furthering your knowledge of VBA. This includes:

  • 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

Working with Ranges

The examples in this section demonstrate how to manipulate worksheet ranges with VBA.

Specifically, we provide examples of copying a range, moving a range, selecting a range, identifying types of information in a range, prompting ...

Get Excel 2016 Power Programming with VBA 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.