Using the Cells Property

Cells is a property of the Application, Worksheet, and Range objects. It returns a Range object that references all of the cells (not just the used cells) in the active worksheet, the specified worksheet, or the specified range, respectively. The usefullness of this property comes from the fact that you can use it to loop through the cells in a range, examining or performing some action on each cell. This is done using the Range object's Item property, which has two available syntax forms:

						object.Cells.Item(RowIndex, ColumnIndex)
object.Cells.Item(RowIndex)

Object is a reference to an Application, Worksheet, or Range object. In the first syntax, RowIndex and ColumnIndex specify the location of a cell with respect to ...

Get Office® XP Development 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.