Microsoft Office 2000/Visual Basic Programmer's Guide   

Understanding the Range Object

In Excel, the Range object is the most powerful, dynamic, and often-used object. Once you develop a full understanding of the Range object and how to use it effectively in VBA procedures, you will be well on your way to harnessing the power of Excel.

The Excel Range object is somewhat unique in terms of objects. In most cases, an "object" is a thing with some clearly identifiable corollary in the Excel user interface. For example, a Workbook object is recognizable as an .xls file. In a workbook, the collection of Worksheet objects is represented in the user interface by separate tabbed sheets. But the Range object is different. A range can be a different thing in different circumstances. A Range object can be a single cell or a collection of cells. It can be a single object or a collection of objects. It can be a row or column, and it can represent a three-dimensional collection of cells that span multiple worksheets. In addition, unlike other objects that exist as objects and as members of a collection of objects, there is no Ranges collection containing all Range objects in a workbook or worksheet. It is probably easiest to think of the Range object as your handle to the thing you want to work with.

Because the Range object is such a fundamental entity within Excel, you will find that many different properties and methods return a Range object that you can use to work with the data in your custom solution. The following sections discuss some basic aspects of Range objects and many of the ways you can return a Range object from a built-in property or method.