Cells
Cells returns a range object containing one or more cells. Returns a WksRange object.
Syntax
object.Cells( Row, Col, LastRow, LastCol )
Parameter |
Type |
Default |
Description |
Row |
Variant |
required; This provides the first row number of the range. |
|
Col |
Variant |
optional; This provides the first column number of the range. You can also provide the column letter (for example "A") in quotes. |
|
LastRow |
Variant |
optional; This provides the last row number of the range. |
|
LastCol |
Variant |
optional; This provides the last column number of the range. You can also provide the column letter (for example "A") in quotes. |
Remarks
See Specifying Cell Coordinates for more information on selecting cells.
Example
This example demonstrates how a set the background color of cells A1:E4 to red.
Wks.Cells(Row:=1,Col:=1,LastRow:=4,LastCol:=5).Format.BackColor = wksColorRed
Used by: WksDocument object, WksRange object